Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #118075] [BUG] $, in list interpreted as '$,' variable rather than bare sigil $ + comma

3 views
Skip to first unread message

Brent Laabs

unread,
May 20, 2013, 4:44:07 PM5/20/13
to bugs-bi...@rt.perl.org
[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 :)

Will Coleda via RT

unread,
Jan 14, 2014, 7:44:58 PM1/14/14
to perl6-c...@perl.org
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

Christian Bartolomaeus via RT

unread,
Oct 15, 2014, 5:45:02 PM10/15/14
to perl6-c...@perl.org
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: https://github.com/perl6/roast/commit/82b0065586
0 new messages