Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Prototypes allow overloading subs?

by BUU (Prior)
on Dec 05, 2002 at 02:38 UTC ( #217655=note: print w/ replies, xml ) Need Help??


in reply to Re: Prototypes allow overloading subs?
in thread Prototypes allow overloading subs?

My immediate thought when you suggested the source filter module, is that it wouldnt be that hard, as you could just steal the method used by c compiler things (if i recall correctly...) that internally turn say "baz(int,int)" into "baz_int_int()", then when you do like "baz(1,1)", it knows how to pass it. The first step seems relatively simple, rewriting sub like "sub foo($,@)" into "sub foo_scalar_array", but that breaks down when you try to determine what the hell the sub is being passed. @x=(1,2); add(@x)?


Comment on Re: Re: Prototypes allow overloading subs?
Re^3: Prototypes allow overloading subs?
by Aristotle (Chancellor) on Dec 08, 2002 at 13:30 UTC
    Perl is just too dynamic. The biggest obstacle is that you can often not know whether you're getting a list or scalar - much like in your example. It gets a whole lot worse when you say something like add(numbers($foo)) and numbers() can return anything from one invocation to the next.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-07-29 03:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls