-Mark
Not directly, no. However, some trickyness with macros would probably
let you do it. I don't yet understand macros well enough to show
you...
Luke
> Mark
> Is it possible with the new parameter declaration syntax to declare
> a mandatory name-only parameter?
Probably. I think that the '?', '*', and '+ prefixes are abbreviations for
traits (C<is optional>, C<is List>, C<is optional is named>). So a named,
mandatory parameter would be:
sub foo($bar is named) {...}
Alternatively, you could just specify a mandatory parameter that has to be a Pair:
sub foo(Pair $bar) {...}
(though then you'd have to use C<$bar.value> for the value).
Damian
My earlier plea for this feature begins here:
http://archive.develooper.com/perl6-l...@perl.org/msg14666.html
I didn't think I made much headway, but this...
On 8/1/03 5:52 PM, Damian Conway wrote:
> Probably.
...is encouraging :)
> I think that the '?', '*', and '+ prefixes are abbreviations for
> traits (C<is optional>, C<is List>, C<is optional is named>). So
> a named, mandatory parameter would be:
>
> sub foo($bar is named) {...}
Good, but a single-letter prefix would also be nice :)
> Alternatively, you could just specify a mandatory parameter that has to be a
> Pair:
>
> sub foo(Pair $bar) {...}
>
> (though then you'd have to use C<$bar.value> for the value).
Ick.
-John