Let's try this again
This started as a reply comment on another post about “people” being rude, that being the case please forgive how it starts.
I'm not sure I agree that the community has always been inclusive, I'll point (again) to chromatic's post back in 2k11 http://modernperlbooks.com/mt/2011/04/civility-starts-with-me.html about issues within the community relating to hostile behavior. We all have the ability to be rude, biting, short, etc. I'm just as guilty as anyone throughout my life both personally and professionally.
I strongly believe this “rude behavior” is due to the passion each of us feel about our beloved Perl. Mithaldu, Buddy Burden, myself and all the others that have either posted or commented on this “fight?”, I assume you/we all love Perl, otherwise none of us would care enough to say anything. It is and has been a huge part of our lives for years, for some of us decades. It's not a bad thing, we will all be rude at some point because we are heavily invested in Perl. When we get a bit to excited it's important for those around us to point it out and ask us to calm down a bit, I'm ok with this. No, I am not suggesting either Mithaldu or Buddy Burden were rude, both have made valid and reasonable comments adding to the discussion.
Moo(se) is pretty damn awesome if you consider the CPAN had nothing great before it, it solves a host of irritating issues that honestly most of us would prefer to not be bothered with (including myself). I happen to work in a medium/large Perl shop that has over a decade of in-house Perl infrastructure. Check the CPAN, Ovid posted both Sub::Signatures and aliased, both of which are our code authorized for public release at Ovid's request. You may or may not like them, they are a very small part of what I'm used to working with, I must assume this has strongly colored my view of public answers to similar questions.
So I said I hated "Modern Perl" (I meant Moo(se)). Why? well the truth in it's in large part to the fact that I've had all the features Moo(se) offers and much more for a very long time. When compared to what I'm used to I find the syntax of Moo(se) ugly (personally). My dislike doesn't make it bad, but it also doesn't mean I have no right to voice my opinion in public. I want to see Moo(se) continue to evolve, grow, get faster, better, increase in functionality and performance while decreasing in it's learning curve because this pushes the community forward, I want this for all public Perl code.
All this being said, I think it is important for every point of view to be discussed on it's merits, not on the charisma of it's current speaker. Why do I prefer C::MM over Moo(se)? Well until I show some code it's simply an idea and put up or shut up applies to me as much as it does anyone else (having reviewed Moo I feel they are *mostly the same with different syntax in how I would use them). I wanted to start a conversation, clearly I came off way more heavy handed then I intended. I've apologized for some of the glaring mistakes I made in my original post, and I've tried hard to be both open and courteous to each and every comment I have either directly or indirectly received. I'll continue to follow the idea that an open discussion is good for me, for you, and for the community.
Modern Perl seems to mean a few different things to different people, that's more clear now then it was when I first posted. Use strict, warnings, unit testing, pair programming, peer review, qa, etc. These have been standard for my development for almost 20 years, so the idea that they are modern didn't enter my mind, they are not modern to me. The CPAN has had tests (some more, some less) for nearly all modules it hosts as long as I've used it, I didn't realize this wasn't how everyone coded both personally and professionally, and this was a stupid assumption on my part (what happens when I assume? Yeah, exactly).
My mentor in Perl taught me to test first and code second, to get peer review on anything that wasn't a 5 minute one time script. He also taught me to be passionate about what I'm doing, to do it right no matter how many re-writes that took, and to take pride in my work. I've written some truly horrible code in my day, and I've written some things I am extremely proud of. I started this conversation with the intent to share my experiences with the community at large, and to encourage more of you to do the same.
If I were to write public code today I'd very likely use Moo, why? Because it's popular (and therefore familiar to many) and because it's not so different from C::MM as to be a stumbling block for me personally. The heart of the conversation I wanted to have with you all was about writing elegant code to solve interesting problems without using ready made answers provided by others. Because code re-use is bad? Not at all, in fact without code re-use many of us would be writing the same things over and over and likely burning out in the process. I wanted to start the conversation because while working on the shoulders of giants is a great way to move forward for many, some of us really want to know the guts, to understand how the wheels work and even possibly improve on their design (I'm not suggesting I have a better wheel). I'd still like to have that conversation (I have multiple posts in the works) with any of you that are interested. Though I'll try to do so without alienating many of you in the process as I clearly did with my previous post.
If you want to consider this post an apology I'm good with that, I did say some things wrong and used some wrong terminology so by all means, take this as an I'm sorry. The heart for me is about having an open conversation about we I think we all love, Perl.
* Moo(se) provides Roles (“safer” mixins, don't believe me? Read the docs on Moo(se) Roles, they are mixins with some attempts to stop you from being stupid). Also Moo(se) allows for flagging ro(p) and data types (beyond scalar, array, hash). I haven't personally checked on this but I'm guessing adding a number to something labeled as a Str will either die or use the chr() of the number, or something similar? None of this is provided by C::MM as far as I'm aware. They are mostly the same in how I would use them, you may very well use them differently.
No, if you add the number 123 to an attribute marked as a Str, then you get the string "123". Because numbers and strings-that-look-like-numbers are essentially indistinguishable in Perl.
If you added an arrayref, or undef, or a filehandle to the attribute though, it would die.
Hi
No, people who are rude are rude because they are angry.
What, exactly, they are angry about you might never know.
It has nothing, repeat nothing, to do with being passionate about Perl.
Cheers
Ron
I am angry about many things. In fact too many things if seen from the PoV of an average person.
Yet this has nothing, repeat nothing, to do with how passionate I am about Perl (don't ask me, ask around instead).
By the way your dismissal of both my passion and anger just made me angrier ;)
Sorry for not replying earlier, typing was hard yesterday due to a finger injury.
Thanks for revising your opinion and taking a softer stance, as well as the kind words directed towards me personally.
However, i fear you'll have to adjust further. I'll explain why. You state:
> I've had all the features Moo(se) offers and much more for a very long time.
Now, that made me pause and look at C::MM v1.12. What i found is that you're half-right and half-wrong. C::MM offers you a TON of features. Moose has some of these, a lot of these Moose doesn't even have (for reasons you should ask #moose about). However, in the plethora C::MM has there also is a LOT missing that Moose offers (a singular example being lazy attributes). So, no, you do not have all the features Moose offers. And this leads me to my second quibble.
> I have [a] right to voice my opinion in public.
Yes, absolutely, and i welcome it. But please, for pete's sake, before you do so, interact with the community and get the whole scope of information and the perspective of other people; to make sure that your opinion is both correct and accurate.
I don't ask for this without a reason. You write well. You write in a way that a newbie might mistake as authorative. And you make many confident statements. What other people fear and where the backlash comes from is that newbies might read your posts and take them for facts, going away with very dangerous misconceptions.
I know in american culture it is pretty much beaten into kids that confidence in the face of everything is the number 1 duty a citicen has. But please, for the sake of Perl, take the maxim "Question everything." and apply it as well to what you consider to be your body of knowledge.
It looks like I made myself misunderstood. Let me simplify my position for convenience: the advances made to Moo(se) have been available to me for a long time. Thus there is nothing new or fancy in Moo(se) that I personally find compelling and I see no good reason to advocate for it. The work on Moo(se) is great, and it clearly has a lot more to accomplish, as evidenced by the fact that it continues to be enhanced. In the meantime, there are many options available to those of us who need to find more efficient, powerful, flexible, and suitable alternatives.
The very POINT of this "blog" is to voice positions for other members of the community. Thus I am, by definition, interacting with the community, as you advise me to do.
As an American, I do question everything. I think maybe there is a language barrier, here. It appears that you are stating that those of us who disagree with you need to adjust their opinions further to align more closely to yours. I must be misreading that; obviously, you do not truly believe that those of us with dissenting views need to "go farther." Perhaps it is your German culture that frames that, I just don't know.
> Thus I am, by definition, interacting with the community, as you advise me to do.
You're interacting only with one part of the community, and more importantly using a venue where it's difficult to efficiently correct misunderstandings because it's not even as close to realtime as the humble email is.
To put this more simply: Chat with us, please. It will be more productive, more englightening and much less painful for *everyone* involved.
> It appears that you are stating that those of us who disagree with you need to adjust their opinions
Come on now. Seriously. There is no big mystery or malicious intent from me here. You said in your last and this blog post these things:
"Moose [...] I believe I chose wisely to stay away. [...] I know what I want, Class::MethodMaker version 1.12 from Sept. 12th, 2003."
"I've had all the features Moo(se) offers and much more for a very long time."
I interpreted that to mean that C::MM gives you everything Moose gives you, which simply wasn't the case. I'm sure you'll agree that that is a reasonable interpretation. I went on to correct you on what seems to be a misunderstanding here.
Apparently i was wrong in my interpretation, but that doesn't mean you need to accuse me of *that* though.
At the end of the day however i still have my doubts about your first statement, even if you used things other than C::MM, and would like you to explain how you elegantly defined lazy attributes without Moo(se).
I have to say, i find it in very poor taste to make accusations like that, followed by enabling comment moderation.
I turned on comment moderation because I'm not going to argue with someone who is continually condescending and rude. Just because we are on the Internet does not mean you get to be excessively rude and that I have to listen to it.
I have no problem with comments about a topic where the commenter is honest, courteous, and fair. You have repeatedly argued against me based on things I did not say but you apparently pulled out of your own interpretation.
Example: I never said C:MM offers lazy loading/init/etc. of attributes (or anything else for that matter). I said that I already have access to those features, I did not say how. You appear to have pulled that together from two different posts of mine and stitched them together in order to make your point.
How would you respond when continually berated about things you didn't say? Fairly similar I would thing. I didn't come here to argue with you or anyone else. I've made that quite clear and yet you seem intent on having some type of argument seemingly with whomever you can get to have one with. I for one, am done arguing with you.
> You appear to have pulled
I did not appear to do so, i literally explained that i did exactly that, and why i did it, just 2 posts above your post; admitted it was a mistake and revised my question after you clarified your point and enabled me to understand it correctly.
> You have repeatedly argued against me
I did that once, to my memory; and upon rereading my past comments can not find a single one outside this blog post i directed toward you, nevermind against you. Maybe you are thinking of comments i made towards rlauer or Jim Schueler?
> How would you respond when continually berated about things you didn't say?
Having actually been in that situation: Calm down, not rush to answer or let myself be forced by others to be hasty in my responses, reread and take stock and make sure i have a clear understanding of who said what.
-----
All that said, i'm only really left curious as to how you had access to such features and would love it if you could elaborate.
> I've had all the features Moo(se) offers and much more for a very long time.
I think Mithaldu was asking *how* you have those features, that is, how you have solved these problems. I'm curious as well.
Which feature(s) are you curious about? I'll do my best to answer given that some of the code I can't talk about in detail due to it being owned by my employer
Mostly I was looking for clarification of this comment:
> I've had all the features Moo(se) offers and much more for a very long time.
But if you could elaborate specifically on lazily-loaded attributes, that would be a good start to the discussion!
That is a rather large topic in and of itself. I'll write a post comparing Moo(se) features against what alternatives exist(ed) prior to Moo(se).
As a short answer to your question, Moo(se) lazy attributes are (according to the docs) stubbed names for class variables that are replaced with their actual value(s) on their first call.
This is a basic caching scheme that is pretty common. Since I use Class::MethodMaker (actually a subclass of this since I have a few small modifications to the CPAN version). C:MM doesn't allow you to assign a default value (v1.12 anyway) so in that case no default value(s) exist to begin with. We have modified this by adding a new C:MM accessor type called once. Once still creates the attribute names but runs memoize on their values on the first get call. You can still change their values using set calls but their default value is delayed and then cached when you call it the first time. While this is different from Moo(se) in design it provides the same functionality. The caching isn't strictly required but it is similar to Moo(se) in that long running default values are cached once loaded so you don't keep taking the hit with repeated calls the to getter unless you specifically force an update. Does that answer your question?