Damian Conway: # Brent Dax wrote: # # > method x ($me: $req, ?$opt, +$namedop, *%named, [EMAIL PROTECTED]) { ... } # > # > Yikes. And I thought we were trying to get *away* from # line noise? # > :^) # > # > Seriously, can't we use something rather prettier, like this? # > # > method x($me: $req, $opt is optional, $namedop is # named, *%named, # > [EMAIL PROTECTED]) { ... } # # It's quite possible that the following equivalences might hold: # # ?$x same as $x is optional # +%y same as %y is named # # So that you could choose.
Sweet. # > I can deal with one really funny character in a signature, # but three # > is a bit much. # # The problem is that if you have multiple optional or named # parameters, things # start getting uncomfortably prolix, and default values end up # a long way from # their owners: # # multi substr(Str $str, $from is optional = $CALLER::_, # $len is optional = # Inf, $new is optional) {...} 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) It's unambiguous, since $CALLER::_ and Inf have both been declared already, so the traits can only refer to the in-the-process-of-declaration variables. (Right?) --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen Configure) >How do you "test" this 'God' to "prove" it is who it says it is? "If you're God, you know exactly what it would take to convince me. Do that." --Marc Fleury on alt.atheism