The stupid question is the question not asked | |
PerlMonks |
Re: Object method prototypes?by shmem (Chancellor) |
on Dec 14, 2007 at 01:05 UTC ( [id://656961]=note: print w/replies, xml ) | Need Help?? |
First argument to a method is its object, whose type is not known at compile time, so the first prototype of a method has to be ignored anyways. Does it make sense to test for the rest of them? I'm glad it was so decided that it doesn't, given the perl5 method call implementation. Things would be different if a method's object wouldn't appear at all in its arguments, but be magically shoehorned into the method's function body as, say, $self, which would mean having a special variable different from all other special variables (of which perlvar tells) in that it is strictly localized and reserved - if and only if the function in question is called as a method. The current implementation is easier to implement (since it's done ;-) Have to see what Perl 6 says... But anyways - you don't need prototypes, except maybe for the & (subroutine/block) type of prototype. --shmem
In Section
Seekers of Perl Wisdom
|
|