in reply to Re2: Mmmm ... cargo cult progamming is nummy!
in thread Adding autoloaded methods to symbol table with using strict refs

The people complaining about this construction are familiar with "Perl culture."

And how is that related to the people being confused about the construction? The people that are complaining about it (including you) are not confused about it. Or are you saying that you're confused about it? That would indeed explain a lot.

Heck, it's arguable that merlyn helped create some of that "Perl culture"!

But that doesn't mean he is the Perl culture. And a culture is a living thing, so who started it is quite irrelevant. By the way, you're not implying that merlyn too is confused about the construction, are you? I hope not.

To call this part of Perl culture is to say that inefficient coding is part of Perl culture. That is something I will not accept.

If people in a culture practice it then it's a part of the culture, is it not? I find it quite irrelevant if you can accept it or not. I'm not trying to convince you to accept a certain moral or whatever. You can't say "I won't accept this conclusion just because I dislike it". Well, you can, of course. It's a free forum, but arguments like that have no weight over here. I don't really agree with your logic though. But it's known that there's a lot of poor Perl code out there. If people use $class = ref $proto || $proto without knowing what it does, then I agree -- that is bad. But if they know what they're doing and have a purpose with it then I disagree.

You also seemed to be confused by a programming-theory concept.

Yes, I am indeed confused about what copy/clone constructors you talk about. The clone constructors I've seen in Perl use no arguments and just makes a deep-copy (sometimes using Data::Dumper or such), alternatively a shallow-copy. Again I wrote a script that tried to find copy/clone methods. I found a few and none of them used any arguments.

You also state that you found a large usage of my $class = ref $proto || $proto;, but didn't find any usage of those constructors as copy constructors. [snip] I personally think that this data does support a conclusion.

I think that the code I used it for was more suited to show that many modules use that construction, than to prove it's not used. Most of the modules that were looked at do not use other modules. So naturally you won't find any $obj->new invocations. But you will find a lot of constructors, and it's in the constructors that you'll find $class = ref $proto || $proto. The material is full of constructors, but few non-self method invocations. This is why I think it's not a good source to prove your point.

If a line of code is a no-op in every instance, then it shouldn't be written.

You're still assuming that people aren't using $obj->new as a short-cut for ref($obj)->new. I'm not as sure of that as you are. And I know in fact that some people like it. I'm not sure they use it though. However, my argumentation is based on that at least some people use it. If you don't agree with that please just state so. But if your trying to make contra arguments please to it in the frame that we're discussing.

Whenever I see my $class = ref $proto || $proto;, I'm looking for this constructor to have use as a copy constructor.

Again I ask why? You just agreed that this particular construction is hardly ever used for copy constructors. Then why do you think it is one? Why do you expect it if you never encounter it? This seems like "cargo-cult thinking". You think it just because... well, just because! At least I assume you do, because you didn't give an explanation.

let's suppose that the line was really $class = ref $proto || $proto; (which doesn't have the my in front of $class). That raises an error under strict.

Oh, so if we don't use this construct we'll get rid of the strict problem? That's really amazing. (Or in other words, why the heck do you bring up this? It's not even remotely related.)

I've tried to do a couple of reality checks (not perfect, but yet enough to get an indication) to get this discussion down from theory to reality. So let's try to face the reality or at least try to find something that indicates that my checks were flawed in some way.