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

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

Thread Next
From:
Father Chrysostomos via RT
Date:
November 28, 2010 13:23
Subject:
[perl #79820] Make my $pi := 4; a syntax error
Message ID:
rt-3.6.HEAD-13564-1290979409-1422.79820-15-0@perl.org
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About