Skip to content
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

$, in list interpreted as '$,' variable rather than bare sigil $ + comma #3144

Closed
p6rt opened this issue May 20, 2013 · 9 comments
Closed

$, in list interpreted as '$,' variable rather than bare sigil $ + comma #3144

p6rt opened this issue May 20, 2013 · 9 comments

Comments

@p6rt
Copy link

p6rt commented May 20, 2013

Migrated from rt.perl.org#118075 (status was 'resolved')

Searchable as RT118075$

@p6rt
Copy link
Author

p6rt commented May 20, 2013

From @labster

[1​:09pm] labster​: r​: my ($a, $c); ($a, $, $c) = 1..3;
[1​:09pm] camelia​: rakudo 14e7d7​:
OUTPUT«[31m===[0mSORRY![31m===[0m␤Unsupported use of $, variable; in Perl 6
please use .join() method␤at /tmp/OlBWFcsobt​:1␤------> [32mmy ($a, $c);
($a, $,[33m⏏[31m $c) = 1..3;[0m␤»
[1​:09pm] labster​: http://perlcabal.org/syn/S02.html#Names says that line
'will result in the message, "Anonymous variable requires declarator".'
[1​:10pm] labster​: r​: my ($a, $c); ($a, $ , $c) = 1..3; #added space
[1​:10pm] camelia​: rakudo 14e7d7​:
OUTPUT«[31m===[0mSORRY![31m===[0m␤Non-declarative sigil is missing its
name␤at /tmp/eFX9NIpWzs​:1␤------> [32mmy ($a, $c); ($a, $[33m⏏[31m , $c) =
1..3; #added space[0m␤ expecting any of​:␤ postfix␤ infix
stopper␤ infix or meta-infix␤ …
[1​:10pm] masak​: labster​: seems the error message is shadowed by rakudo
thinking it's the $, variable
[1​:11pm] masak​: ...or another error message is. :)
[1​:11pm] labster​: so, theoretically a rakudobug, but do we really want
exact wording for error messages defined by the spec?
[1​:15pm] masak​: I think it's a rakudobug that it considers ($a, $, $c) as
being the '$,' variable.
[1​:15pm] PerlJam​: labster​: The message in the spec at least points them in
the direction that anonymous vars can only be used in declarators
[1​:15pm] masak​: but I don't know what to do about it, really.
[1​:18pm] labster​: Well really, the only place you should ever write $, is
in a subroutine signature.
[1​:20pm] PerlJam​: labster​: You don't think "my ($a,$,$c) =
$string.split(/\t/);" would ever happen?
[1​:20pm] labster​: oh... right
[1​:20pm] labster​: I'm not thinking straight.
[1​:21pm] lizmat​: r​: my ( $a, Mu, $c )= <a b c>; say $a; say $c
[1​:21pm] camelia​: rakudo 14e7d7​: OUTPUT«a␤c␤»
[1​:21pm] labster​: r​: my ($a,$,$c) = "a b c".split(/\s/);
[1​:21pm] camelia​: rakudo 14e7d7​: ( no output )
[1​:22pm] labster​: hm
[1​:27pm] dalek​: std​: 8850393 | larry++ | STD.pm6​:
[1​:27pm] dalek​: std​: only carp about P5 $, variable where it's obvious
[1​:27pm] dalek​: std​: review​: https://github.com/perl6/std/commit/8850393dd7
[1​:34pm] masak​: TimToady++
[1​:35pm] labster​: okay, shall i submit a proper rakudobug then?
[1​:35pm] PerlJam​: labster​: can't hurt
[1​:36pm] jnthn​: plz reference the STD commit TimToady++ just made too, so
the fixer knows where to steal a fix :)

@p6rt
Copy link
Author

p6rt commented May 23, 2013

From @FROGGS

Fixed​:
rakudo/rakudo@25bfa5f

Closable with test.

@p6rt
Copy link
Author

p6rt commented May 23, 2013

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 23, 2013

From @labster

Well, almost fixed. The spec says​:

Attempts to say something like​:
($a, $, $c) = 1..3;
will result in the message, "Anonymous variable requires declarator".

It results in the message​:

Non-declarative sigil is missing its name
which is also what STD generates. So is this now a specsbug or rakudobug?

@p6rt
Copy link
Author

p6rt commented Jan 15, 2014

From @coke

On Thu May 23 14​:54​:13 2013, labster wrote​:

Well, almost fixed. The spec says​:

Attempts to say something like​:
($a, $, $c) = 1..3;
will result in the message, "Anonymous variable requires declarator".

It results in the message​:

Non-declarative sigil is missing its name
which is also what STD generates. So is this now a specsbug or rakudobug?

Lack of test has allowed behavior to revert to original quoted on ticket​:

19​:44 < [Coke]> r​: my $a; my $c; ($a, $, $c) = 1..3;
19​:44 <+camelia> rakudo-jvm 4f66ce​: OUTPUT«===SORRY!=== Error while compiling
  /tmp/_8CZwy0Onq␤Unsupported use of $, variable; in Perl 6
  please use $*OUT.output_field_separator()␤at
  /tmp/_8CZwy0Onq​:1␤------> my $a; my $c; ($a, ⏏$, $c) = 1..3;␤
  expecti…»
--
Will "Coke" Coleda

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 15, 2014

From @coke

On Thu May 23 14​:54​:13 2013, labster wrote​:

Well, almost fixed. The spec says​:

Attempts to say something like​:
($a, $, $c) = 1..3;
will result in the message, "Anonymous variable requires declarator".

It results in the message​:

Non-declarative sigil is missing its name
which is also what STD generates. So is this now a specsbug or rakudobug?

Lack of test has allowed behavior to revert to original quoted on ticket​:

19​:44 < [Coke]> r​: my $a; my $c; ($a, $, $c) = 1..3;
19​:44 <+camelia> rakudo-jvm 4f66ce​: OUTPUT«===SORRY!=== Error while compiling
  /tmp/_8CZwy0Onq␤Unsupported use of $, variable; in Perl 6
  please use $*OUT.output_field_separator()␤at
  /tmp/_8CZwy0Onq​:1␤------> my $a; my $c; ($a, ⏏$, $c) = 1..3;␤
  expecti…»
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 15, 2014

From @usev6

This works now​:

$ perl6-m -e 'my ($a, $c); ($a, $ , $c) = 1..3; say $a; say $c'
1
3

Also, S02 was modified recently (https://github.com/perl6/specs/commit/aadf0589905c9d76488fd81f738201d12f6d9eeb) and the new version explicitly allows the use of "($a, $, $c) = 1..3;"

I added a test to S03-operators/assign.t with the following commit​: Raku/roast@82b0065586

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 15, 2014

From @usev6

This works now​:

$ perl6-m -e 'my ($a, $c); ($a, $ , $c) = 1..3; say $a; say $c'
1
3

Also, S02 was modified recently (https://github.com/perl6/specs/commit/aadf0589905c9d76488fd81f738201d12f6d9eeb) and the new version explicitly allows the use of "($a, $, $c) = 1..3;"

I added a test to S03-operators/assign.t with the following commit​: Raku/roast@82b0065586

@p6rt
Copy link
Author

p6rt commented Oct 15, 2014

@usev6 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant