in reply to RFC: Simulating Ruby's "yield" and "blocks" in Perl
> argument signatures are lengthy in Perl
With the same technique like demonstrated in yield() one could simulate a syntac sugar function sig(), which would assign arguments from the upper caller sig( my($a,$b) ). sig could easily handle a lot more like:
But the need to declare each variable to be lexical is cumbersome, who really wants to constantly repeat my ?
sub test { sig my $x='default', my $y, named => my $named, OPT; ... code ... }
so having a new keyword or syntax would facilitate things a lot
something like
... }sub test { mine $x='default', $y, named => $named, @OPT;
or even better
sub test { | $x='default', $y, named => $named, @OPT |; ... }
while I'm not sure if it's possible to use | w/o dangerous ambiguity.
Cheers Rolf
( addicted to the Perl Programming Language)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RFC: Simulating Signatures
by curiousmonk (Beadle) on Apr 23, 2013 at 03:43 UTC | |
by LanX (Saint) on Apr 23, 2013 at 15:10 UTC |