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

R operator do not work properly with short form, like ~= #900

Closed
p6rt opened this issue Apr 18, 2009 · 10 comments
Closed

R operator do not work properly with short form, like ~= #900

p6rt opened this issue Apr 18, 2009 · 10 comments

Comments

@p6rt
Copy link

p6rt commented Apr 18, 2009

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

Searchable as RT64818$

@p6rt
Copy link
Author

p6rt commented Apr 18, 2009

From @ilyabelikin

Hi there,

my $foo = 'foo'; say $foo = 'foo' ~ 'a';
fooa

my $foo = 'foo'; say $foo R~= 'foo';
0foo

may be it should not work at all, but currently behaviour is strange.

Ilya

@p6rt
Copy link
Author

p6rt commented Apr 23, 2009

From @moritz

On Sat Apr 18 01​:37​:34 2009, ihrd wrote​:

Hi there,

my $foo = 'foo'; say $foo = 'foo' ~ 'a';
fooa

my $foo = 'foo'; say $foo R~= 'foo';
0foo

may be it should not work at all, but currently behaviour is strange.

FYI, STD.pm says "Can't reverse a concatenation because it's too
fiddly", so it should probably be a parse error as well.

@p6rt
Copy link
Author

p6rt commented Apr 23, 2009

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

@p6rt
Copy link
Author

p6rt commented Aug 2, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S03-operators/assign.t

commit 0d46a3f0651a2f1cf8c93390bbc9cbb5c59bd353
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun Aug 2 20​:38​:29 2009 +0000

  [t/spec] Test for RT #​64818
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27857 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S03-operators/assign.t b/t/spec/S03-operators/assign.t
index 3c98bee..c94ca4c 100644
--- a/t/spec/S03-operators/assign.t
+++ b/t/spec/S03-operators/assign.t
@@ -6,7 +6,7 @@ use Test;
 #                      V
 # L<S03/Changes to Perl 5 operators/list assignment operator now parses on the right>
 
-plan 238;
+plan 239;
 
 
 # tests various assignment styles
@@ -319,6 +319,10 @@ my @p;
     is(@p[1],'plugh', "~= operator parses as item assignment 2");
 }
 
+# RT #64818
+eval_dies_ok q{my $foo = 'foo'; $foo R~= 'foo';},
+             'R~= operator is a parse error';
+
 {
     my $x = "abc";
     @p = $x x= 3, 4;

@p6rt
Copy link
Author

p6rt commented Aug 2, 2009

From @kyleha

On today's Rakudo, this "R~=" thing does not parse (says "No applicable
methods"), but that error message could be a bit more awesome, I think.

@p6rt
Copy link
Author

p6rt commented Aug 2, 2010

From @bbkr

On * build

[12​:00] <bbkr> rakudo​: my $foo = "foo"; say $foo R~= "foo"
[12​:00] <p6eval> rakudo 9b6189​: OUTPUT«Cannot modify readonly valueâ�¤ in
'&infix​:<=>' at line 1â�¤ in 'reverseargs' at line 130​:CORE.settingâ�¤ in
main program body at line 1�»

@p6rt
Copy link
Author

p6rt commented Aug 2, 2010

From @moritz

On Mon Aug 02 03​:02​:42 2010, bbkr wrote​:

On * build

[12​:00] <bbkr> rakudo​: my $foo = "foo"; say $foo R~= "foo"
[12​:00] <p6eval> rakudo 9b6189​: OUTPUT«Cannot modify readonly valueâ�¤ in
'&infix​:<=>' at line 1â�¤ in 'reverseargs' at line 130​:CORE.settingâ�¤ in
main program body at line 1�»

This is correct behaviour; however

12​:06 < moritz_> rakudo​: my ($x, $y) = <a b>; $x R~= $y; say "$x $y"
12​:06 <+p6eval> rakudo 9b6189​: OUTPUT«a aâ�¤Â»

does not look good.

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

On Mon Aug 02 03​:07​:18 2010, moritz wrote​:

On Mon Aug 02 03​:02​:42 2010, bbkr wrote​:

On * build

[12​:00] <bbkr> rakudo​: my $foo = "foo"; say $foo R~= "foo"
[12​:00] <p6eval> rakudo 9b6189​: OUTPUT«Cannot modify readonly
value� in
'&infix​:<=>' at line 1â�¤ in 'reverseargs' at line
130​:CORE.settingâ�¤ in
main program body at line 1�»

This is correct behaviour; however

12​:06 < moritz_> rakudo​: my ($x, $y) = <a b>; $x R~= $y; say "$x $y"
12​:06 <+p6eval> rakudo 9b6189​: OUTPUT«a aâ�¤Â»

does not look good.

works now. marking testneeded.

17​:16 < diakopter> rakudo​: my ($x, $y) = <a b>; $x R~= $y; say "$x $y"
17​:16 <+p6eval> rakudo 024843​: OUTPUT«a baâ�¤Â»
17​:16 < diakopter> n​: my ($x, $y) = <a b>; $x R~= $y; say "$x $y"
17​:16 <+p6eval> niecza v18-1-gc86e3f0​: OUTPUT«a baâ�¤Â»
17​:16 < diakopter> sorear​: are those right? if so, I'll close rakudo's
#​64818
17​:37 < sorear> diakopter​: I do beleive so

@p6rt
Copy link
Author

p6rt commented May 30, 2012

From @diakopter

On Tue May 29 15​:44​:21 2012, diakopter wrote​:

On Mon Aug 02 03​:07​:18 2010, moritz wrote​:

On Mon Aug 02 03​:02​:42 2010, bbkr wrote​:

On * build

[12​:00] <bbkr> rakudo​: my $foo = "foo"; say $foo R~= "foo"
[12​:00] <p6eval> rakudo 9b6189​: OUTPUT«Cannot modify readonly
value� in
'&infix​:<=>' at line 1â�¤ in 'reverseargs' at line
130​:CORE.settingâ�¤ in
main program body at line 1�»

This is correct behaviour; however

12​:06 < moritz_> rakudo​: my ($x, $y) = <a b>; $x R~= $y; say "$x $y"
12​:06 <+p6eval> rakudo 9b6189​: OUTPUT«a aâ�¤Â»

does not look good.

works now. marking testneeded.

17​:16 < diakopter> rakudo​: my ($x, $y) = <a b>; $x R~= $y; say "$x $y"
17​:16 <+p6eval> rakudo 024843​: OUTPUT«a baâ�¤Â»
17​:16 < diakopter> n​: my ($x, $y) = <a b>; $x R~= $y; say "$x $y"
17​:16 <+p6eval> niecza v18-1-gc86e3f0​: OUTPUT«a baâ�¤Â»
17​:16 < diakopter> sorear​: are those right? if so, I'll close
rakudo's
#​64818
17​:37 < sorear> diakopter​: I do beleive so

fixed/added tests to matched expected behavior. it does in fact parse
(as STD allows), and works in both rakudo and niecza.

@p6rt
Copy link
Author

p6rt commented May 30, 2012

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

@p6rt p6rt closed this as completed May 30, 2012
@p6rt p6rt added the testneeded label Jan 5, 2020
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