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}

In reply to Re: Object method prototypes? by shmem
in thread Object method prototypes? by zrajm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.