Skip Menu |
Report information
Id: 131389
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Some parsing glitch with `\term` in a string
Download (untitled) / with headers
text/plain 2.3k
IRC: https://irclog.perlgeek.de/perl6-dev/2017-05-28#i_14648548 The first eval uses emoji cat in a string and it works; The second one tries to do the same in a bit more elaborate eval and it crashes with bogus term error; The third one executes the same code, except swapping \term:<😹> to \x, and it works fine; The fourth one executes the same code, except swapping \term:<😹> to \term:<x>, and now it crashes with "undeclared routine x"; The last one uses \term:<x>, except it works fine. Seems in the problematic cases, the defined \term is not seen by the block inside the string. 09:07 Zoffix m: my \term:<😹> = -42; say 😹; say 😹.abs; say "{😹}"; my $foo = ''; say "{😹.abs}:$foo" for 😹.abs 09:07 camelia rakudo-moar 87d0e0: OUTPUT: «-42␤42␤-42␤42:␤» 09:07 Zoffix m: '/tmp/file1'.IO.spurt: "a\nb\nc"; '/tmp/file2'.IO.spurt: "d\ne\n"; '/tmp/file3'.IO.spurt: "f\ng\nh\ni"; my $line; my \term:<😹> = IO::CatHandle.new('/tmp/file1', '/tmp/file2'.IO, '/tmp/file3'.IO.open, :on-switch{ $line = 1 }); say "{😹.path}:$line $_" for 😹.lines 09:07 camelia rakudo-moar 87d0e0: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>:1␤------> 3 :on-switch{ $line = 1 }); say "{7⏏5😹.path}:$line $_" for 😹.lines␤ expecting any of:␤ prefix␤ term␤» 09:07 Zoffix m: '/tmp/file1'.IO.spurt: "a\nb\nc"; '/tmp/file2'.IO.spurt: "d\ne\n"; '/tmp/file3'.IO.spurt: "f\ng\nh\ni"; my $line; my \x = IO::CatHandle.new('/tmp/file1', '/tmp/file2'.IO, '/tmp/file3'.IO.open, :on-switch{ $line = 1 }); say "{x.path}:$line $_" for x.lines 09:07 camelia rakudo-moar 87d0e0: OUTPUT: «/tmp/file1:1 a␤/tmp/file1:1 b␤/tmp/file1:1 c␤/tmp/file2:1 d␤/tmp/file2:1 e␤/tmp/file3:1 f␤/tmp/file3:1 g␤/tmp/file3:1 h␤/tmp/file3:1 i␤» 09:12 m: '/tmp/file1'.IO.spurt: "a\nb\nc"; '/tmp/file2'.IO.spurt: "d\ne\n"; '/tmp/file3'.IO.spurt: "f\ng\nh\ni"; my $line; my \term:<x> = IO::CatHandle.new('/tmp/file1', '/tmp/file2'.IO, '/tmp/file3'.IO.open, :on-switch{ $line = 1 }); say "{x.path}:$line $_" for x.lines 09:12 camelia rakudo-moar 87d0e0: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ x used at line 1␤␤» 09:12 Zoffix m: my \term:<x> = 42; say x.path 09:12 camelia rakudo-moar 87d0e0: OUTPUT: «"42".IO␤»


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org