develooper Front page | perl.perl5.porters | Postings from November 2010

[perl #79820] Make my $pi := 4; a syntax error

Thread Next
Father Chrysostomos via RT
November 28, 2010 13:23
[perl #79820] Make my $pi := 4; a syntax error
Message ID:
On Fri Nov 26 08:04:16 2010, nicholas wrote:
> I believe that there is consensus that
> a: it would be useful to have a binding operator in Perl 5
> b: that := is the obvious candidate
> hence at some point we need to re-use := for this.

No consensus was ever reached. Many still prefer the \$foo = \$bar
syntax as it makes the edge cases obvious:

\$foo = \$bar; # simple alias
\@foo = \@bar; # simple alias
\(@foo) = \(@bar); # alias each element
\(@foo) = @list; # alias each element (RHS must contain scalar refs)
\@foo[0..$#list] = @list; # similar
\(@foo) = \$bar; # alias $foo[0] to $bar
\(@foo) = \@bar; # error; RHS is not a scalar ref
\@foo[0..5] = \@bar; # error; RHS is not a scalar ref
\@foo = $bar; # only works if bar is an array ref

But, nonetheless, I see nothing wrong with making this a syntax error.
Three others have shown their approval. So I have just applied it (fancy
that! that *I* should be applying *your* patches!) as 2dc78664.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About