Larry Wall skribis 2005-11-18 11:36 (-0800):
> In Perl 5, to set a slice, you have to write
>     %hash{ @keys } = @values;

"@"... :)

> whereas in Perl 6, it'd be nice to be able to say that with all
> the keys and values on the right side somehow.

Shouldn't a simple

    %hash = @keys Y @values;

suffice?

I disagree, though, that --except for the case of initializing the hash
together with its declaration-- having the keys on the LHS is bad. It's
actually very good documentation, and to me, much clearer than any of
your examples:

>     @bins:[] = label { calc_int($_) } LIST;
>     %bins:{} = label { calc_str($_) } LIST;
>     @bins.pairs = label { calc_int($_) } LIST;
>     %bins.pairs = label { calc_str($_) } LIST;

Which really all are more complex than the initial example:

>     map { calc_int($_) => $_ } LIST

Are commas optional after closures?

>     %bins.pairs = %bins.pairs, label { calc_str($_) } LIST;

Is , higher precedence than = now?

>     %bins.clear.pairs = label { calc_str($_) } LIST;

As someone who hates methods that return the invocant itself (even if
that isn't technically what happens), I have to object. Such combination
doesn't work well in my brain. I'd prefer:

    %bins.clear;
    %bins.pairs = ...;

Although I think the current situation with simple assignment is still
much better:

    %bins = ...;


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to