New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The => operator doesn't quote v-strings in "use constant v1 => 42" #13511
Comments
From lappy@zoffix.comCreated by zoffix@zoffix.comThe fat comma operator (=>) doesn't seem to quote v-strings when used in Perl Info
|
From @LeontOn Mon, Jan 6, 2014 at 5:50 PM, Zoffix Znet <perlbug-followup@perl.org>wrote:
use optionally takes a version, so that is parsed as «use <module> Leon |
The RT System itself - Status changed from 'new' to 'open' |
From @sciuriusLeon Timmermans <fawaka@gmail.com> writes:
The question is: is this desired (a.o.t. actual) behaviour, or should use constant v1 => 1; DWIM? -- Johan |
From @b2gillsOn Tue, Jan 7, 2014 at 1:21 AM, Johan Vromans <jvromans@squirrel.nl> wrote:
I would expect that to be the equivalent to `use constant ('v1',1)` Although it makes it more difficult to create a v-string with a single perl -MDevel::Peek -E'use constant "v1" => 2;$v= v1;say Dump $v' perl -MDevel::Peek -E'use constant "v1" => 2;$v= v01;say Dump $v' So creating a subroutine matching `/\Av[0-9]+\z/` should probably be ( Further discussion of having constant warn, or adding a discouragement |
From @sciuriusBrad Gilbert <b2gills@gmail.com> writes:
Yes, but the syntax of 'use' is (perdoc -f): use Module VERSION LIST and not use Module VERSION , LIST (note the comma). So in use Module X,Y,Z; X,Y,Z is the LIST part, even if X resembles a version number. The use Module X Y,Z; -- Johan |
From @cpansproutOn Mon Jan 06 23:21:34 2014, jv wrote:
Probably, especially considering that this dwims: use constant v1=> 1; -- Father Chrysostomos |
From @kentfredricOn 7 January 2014 22:04, Johan Vromans <jvromans@squirrel.nl> wrote:
Indeed, seems obvious given that criteria that use Module 1, 2; # Valid, passes [ 1, 2 ] and use Module 1 => 2; # Syntax error it seems they'd aught to parse the same way. Just they don't. use v5.18; BEGIN { our $VERSION = 9999; use Data::Dump qw(pp); sub import { my @code = ( q[use TestClass 1, 2], q[use TestClass ( 1 => 2 )], ); for my $code ( @code ) { __[ output ]__ -- -- -- -- -- -- -- -- -- |
From @b2gillsOn Tue, Jan 7, 2014 at 3:04 AM, Johan Vromans <jvromans@squirrel.nl> wrote:
I said it is being parsed as the version part, not that is what I expected. use constant; sub v1(){1} That is I would have expected it to be parsed as the first item Which is why I also said it would make it difficult to create a v-string |
From @rjbsI agree with the general consensus that this is a bug. -- |
From [Unknown Contact. See original ticket]I agree with the general consensus that this is a bug. -- |
Migrated from rt.perl.org#120941 (status was 'open')
Searchable as RT120941$
The text was updated successfully, but these errors were encountered: