Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Object method prototypes?

by Joost (Canon)
on Dec 14, 2007 at 00:36 UTC ( [id://656954]=note: print w/replies, xml ) Need Help??


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..

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found