On Tuesday, March 11, 2003, at 08:41 AM, Brent Dax wrote:
Almost makes you wish for those backwards declarations from C that
computer scientists always gripe about, eh? :^) Well, what about this?
multi substr(Str $str, $from = $CALLER::_ is optional, $len = Inf is optional, $new is optional)
Well, if we have alternate spellings of all the markers:
$arg is default(1) # same as $arg = 1
$arg is optional # same as ?$arg
$arg is named # same as +$arg
@list is variadic # same as [EMAIL PROTECTED]
@list is slurpy # (possible alternate spelling)
@list is greedy # (possible alternate spelling)This would lend a little more credence to the notion that you can put the C<=> in whatever order you want. Well, maybe. OK, maybe not. But if you have an C<is default> spelling, you wouldn't care so much...
Wimpy, readable code:
multi substr (
Str $str,
$from is default($CALLER::_) is optional,
$len is default(Inf) is optional,
$new is optional
) {...}# is same as
multi substr (
Str $str,
$from is optional is default ($CALLER::_),
$len is optional is default(Inf),
$new is optional
) {...}Manly, expert code:
multi substr (
Str $str,
?$from = $CALLER::_,
?$len = Inf,
?$new
) {...}MikeL
