Closed p5pRT closed 13 years ago
Currently the := in my $pi := 4; is interpreted as an empty attribute list. As of 5.12.0\, using := here issue a deprecation warning.
No Perl 5 code on CPAN is using :=
If code generators need the flexibility to generate empty attribute lists\, it's trivial to do so by adding a space before the =
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.
Use of := for binding can't be distinguished from use of it to mean an empty attribute list. Hence I propose that we make := a syntax error for 5.14\, so that there is at least 1 major version of Perl 5 where any accidental use will be caught with a clear\, comprehensible syntax error message.
Nicholas Clark
2010/11/26 Nicholas Clark \perlbug\-followup@​perl\.org:
# New Ticket Created by Nicholas Clark # Please include the string: [perl #79820] # in the subject line of all future correspondence about this issue. # \<URL: http://rt.perl.org/rt3/Ticket/Display.html?id=79820 >
Currently the := in my $pi := 4; is interpreted as an empty attribute list. As of 5.12.0\, using := here issue a deprecation warning.
No Perl 5 code on CPAN is using :=
If code generators need the flexibility to generate empty attribute lists\, it's trivial to do so by adding a space before the =
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.
Use of := for binding can't be distinguished from use of it to mean an empty attribute list. Hence I propose that we make := a syntax error for 5.14\, so that there is at least 1 major version of Perl 5 where any accidental use will be caught with a clear\, comprehensible syntax error message.
Yes
When can we expect Chip to come up with BIND? How can we help? -- Reini Urban
The RT System itself - Status changed from 'new' to 'open'
On Fri\, Nov 26\, 2010 at 08:04:17AM -0800\, Nicholas Clark wrote:
Hence I propose that we make := a syntax error for 5.14\,
+1
-- Never do today what you can put off till tomorrow.
On Sun\, Nov 28\, 2010 at 12:38:36PM +0000\, Dave Mitchell wrote:
On Fri\, Nov 26\, 2010 at 08:04:17AM -0800\, Nicholas Clark wrote:
Hence I propose that we make := a syntax error for 5.14\,
+1 +1
-- Never do today what you can put off till tomorrow.
--
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.
@cpansprout - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#79820 (status was 'resolved')
Searchable as RT79820$