Luke Palmer wrote at Wed, 25 Sep 2002 00:09:41 +0200: Very good written text.
> =head1 DESCRIPTION > > Because of the addition of the flattening operator, parentheses in Perl 6, > when used as list constructors, are entirely redundant with brackets. > Additionally, parentheses have one inconsistency which brackets do not: > This is the following case, already shown on perl6-language: > > $a = (); # $a is a list reference with 0 elements > $a = (10); # $a is the scalar 10 > $a = (10, 20); # $a is a list reference with 2 elements > # ... > > If the ability to construct lists with parentheses is removed, so is this > inconsistency. This has the added benefit that there is a significant > visual clue about when a list is being tossed around. This doesn't break > any convenience, just changes the look of it: > > # Perl 6 # Perl 5 > [$a, $b] ^= [$b, $a]; # ($a, $b) = ($b, $a) > print *[$a=$b],"\n"; # print(($a=$b), "\n"); > push @a: *[1,2,3]; # push @a, (1,2,3); > push @a: [1,2,3]; # push @a, [1,2,3]; I didn't follow the Perl6 discussion very well, so I have perhaps the advantage seeing all this with Perl5 eyes only. Perhaps it's a good idea to add an explanation what is the most significant benefit of this new notion. It's only said, that there is a significant visual clue about when a list is being tossed around. As I don't feel much that I don't know whether a variable is in list or scalar context in Perl5, I'm asking whether there are some more (important) advantages. Especially as there is an obviously disadvantage of the Perl6 syntax: It's in all lines but the last one character longer :-)) As I'm sure that there is the chance of 1,2 or 3 short sentences explaining the real advantages, I only wanted to ask for a completion of this nice text. Greetings, Janek