Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Object method prototypes?

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

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Object method prototypes?
by zrajm (Beadle) on Dec 14, 2007 at 01:52 UTC
    I'm absolutely amazed at the speed with which you all replied and the usefulness of your answers. Why, oh why, did I not become a PerlMonk earlier?

    It seems my ideas about what prototypes was all about needed some serious corrections. Many thanks to all of you above for helping me become a better perl programmer. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://656961]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-26 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found