There's more than one way to do things | |
PerlMonks |
Re: Re^2: Function Prototypes and Array vs. List (Pt. 2)by ariels (Curate) |
on Jun 13, 2002 at 14:47 UTC ( [id://174225]=note: print w/replies, xml ) | Need Help?? |
No, your hypothetical create method is simply wrong. It's buggy. It should be (to paraphrase John Cleese) a NON-method. It should be bereft of life and pushing up the daisies.
The only reason to use prototypes is in order to give your functions the same syntax as various Perl builtins. E.g., with prototypes you can write a mymap that will have the same semantics as map. Your ``create'' method isn't doing that; it's using a prototype in order to create a bug. I could equally well claim that map is broken, because this code does something very strange. You're right about coding, though: In order to make sure code does not have a bug, it is not enough to check documentation. You must look at the code. Why are you using a prototype? So far you've shown excellent reasons for you not to use a prototype for this function. ``Doctor, whenever I leave the spoon in the cup and drink my tea, my eye hurts!''
In Section
Seekers of Perl Wisdom
|
|