in reply to Object method prototypes?

Prototypes are determined at compile time and with that come several restrictions that make it a very bad fit for object-oriented constructs in perl. For one, it's terribly hard in specific cases and in general impossible for the perl compiler to determine an object's class at compile-time (i.e. by static analysis of the source code) so it won't be able to check which of any number of same-named functions will be used in a method invocation.

Also, perl's prototypes are really not about argument checking. They are about argument coercion - they don't really match what prototypes in C or Java for instance do.

See also Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl

Replies are listed 'Best First'.
Re^2: Object method prototypes?
by zrajm (Beadle) on Dec 14, 2007 at 01:48 UTC
    Yup. shmem referred me to that document in the chatterbox. So the first thing I did after starting this thread was to read it.

    And I don't think I'll be using prototypes much any more..