in reply to Re^2: Function Prototypes and Array vs. List (Pt. 2)
in thread Function Prototypes and Array vs. List (Pt. 2)
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.my %hash = map { $_ => X => 1 } qw(a b c d)
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!''
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Function Prototypes and Array vs. List (Pt. 2)
by Abigail-II (Bishop) on Jun 13, 2002 at 16:13 UTC |