foo(:a<1>, :b<2>)
And had the thought that we might be able to get away with treating
named parameters as lvalues, making the above:
foo(:a=1, :b=2)
Would this be unreasonable? Does it break anything else? I'm not sure
that subscripting-like notation would be a bad thing to have, but if we
could "assign" an arbitrary expression to a name parameter, I think
subroutine and method calls would be a heck of a lot more like their own
documentation. It also makes things like this easier to write:
arc(:radians=pi);
If you use this syntax for something that would be auto-quoted, it's one
extra character:
add_user(:username="ajs");
but later edits are less complicated:
add_user(:username="ajs-1");
Thoughts? Is it too late?
foo(:a<1>, :b<2>);
is
foo( a => '1', b => '2' );
.
If you want to assign an arbitrary expression to a named parameter
my $user = "ajs";
add_user( username => $user );
then you would use the above or
add_user( :username($user) );
.
If you look closely a lot of Perl 6 syntax is just shortcuts on
Perl 5 syntax.
It's probably never too late with a language explicitly designed
to be mutable but if I had to guess you'll have to code it up as
a new grammar rule and include it yourself via a pragma or other
explicit declaration.
-ljr