On 4/19/04 7:16 PM, Larry Wall wrote:
> On Mon, Apr 19, 2004 at 01:44:53PM -0400, John Siracusa wrote:
> : ...named and required, or named and optional? IOW, is this all true?
> :
> : sub foo(+$a, +$b) { ... }
> :
> : foo(); # compile-time error!
> : foo(1, 2); # compile-time error!
> : foo(a => 1, 2); # compile-time error!
> : foo(a => 1); # compile-time error!
> :
> : foo(a => 5, b => 7); # ok
> : foo(b => 1, a => 2); # ok
>
> Well, no, we're still stuck at run-time validation of that. In the case
> of methods you can't really do anything else anyway, generally speaking.
Why is that?
> For subs, we could make the compiler pay attention to something in the
> declaration:
>
> sub foo(+$a is req, +$b is req) { ... }
> sub foo(+$a = fail, +$b = fail) { ... }
>
> But I still don't think it rates a strange character of its own.
I'd even be willing to type out "is required." I just want the feature :)
The "is fail" technique looks slightly icky...
> Possibly there's something going on with multi subs and invocants.
> I'm not sure what 6.0.0 will make of a declaration like:
>
> multi sub foo(+$a, +$b: +$c) { ... }
>
> since we've told the Parrot people they don't have to worry about
> anything but positional parameters for 6.0.0.
Can we do some magic behind the scenes that will make "required named
params" look positional to parrot?
-John