Skip Menu |
Report information
Id: 131900
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: dan [at] zwell.net
tonnerre.p [at] gmail.com
Cc:
AdminCc:

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



Date: Tue, 15 Aug 2017 14:24:40 +0200
To: rakudobug [...] perl.org
From: Patrick Tonnerre <tonnerre.p [...] gmail.com>
Subject: [BUG] REPL issue defining new operator with Euro symbol
Download (untitled) / with headers
text/plain 752b
Hi,

context is :
MBP running macOS Sierra 10.12.6
RakudoStar dmg installed
This is Rakudo version 2017.07 built on MoarVM version 2017.07
implementing Perl 6.c.

When executing the following commands under REPL, i got that issue :
> sub postfix:<€> (Int $n) {2*$n};
sub postfix:<€> (Int $n) { #`(Sub+{Precedence}|140257667062944) ... }
> say 21€
===SORRY!=== Error while compiling:
Bogus postfix
------> say 21
    expecting any of:
        infix
        infix stopper
        postfix
        statement end
        statement modifier
        statement modifier loop

Running the same statements into a script is working fine :
#!/usr/bin/env perl6

sub postfix:<€> (Int $n) {2*$n}

say 21€;

./operators.pl6 
42

Regards
— 
Patrick

Subject: Re: [perl #131900] [BUG] REPL issue defining new operator with Euro symbol
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
To: "Patrick Tonnerre (via RT)" <perl6-bugs-followup [...] perl.org>
Date: Tue, 15 Aug 2017 21:06:28 +0200
Download (untitled) / with headers
text/plain 1.3k
This appears to be forgetfulness of the REPL from one input to the next. If you put it on the same line, it *does* work: Show quoted text
> sub postfix:<€> (Int $n) {2*$n}; say 42€
84 So this boils down to a much more generic issue, for which we already have tickets I believe. Show quoted text
> On 15 Aug 2017, at 14:25, Patrick Tonnerre (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Patrick Tonnerre > # Please include the string: [perl #131900] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=131900 > > > > Hi, > > context is : > MBP running macOS Sierra 10.12.6 > RakudoStar dmg installed > This is Rakudo version 2017.07 built on MoarVM version 2017.07 > implementing Perl 6.c. > > When executing the following commands under REPL, i got that issue :
>> sub postfix:<€> (Int $n) {2*$n};
> sub postfix:<€> (Int $n) { #`(Sub+{Precedence}|140257667062944) ... }
>> say 21€
> ===SORRY!=== Error while compiling: > Bogus postfix > ------> say 21⏏€ > expecting any of: > infix > infix stopper > postfix > statement end > statement modifier > statement modifier loop > > Running the same statements into a script is working fine : > #!/usr/bin/env perl6 > > sub postfix:<€> (Int $n) {2*$n} > > say 21€; > > ./operators.pl6 > 42 > > Regards > — > Patrick
To: perl6-bugs-followup [...] perl.org
Subject: Re: [perl #131900] [BUG] REPL issue defining new operator with Euro symbol
From: Patrick Tonnerre <tonnerre.p [...] gmail.com>
Date: Wed, 16 Aug 2017 10:47:37 +0200
Download (untitled) / with headers
text/plain 1.5k
It works, thank you Show quoted text
> Le 15 août 2017 à 21:06, Elizabeth Mattijsen via RT <perl6-bugs-followup@perl.org> a écrit : > > This appears to be forgetfulness of the REPL from one input to the next. If you put it on the same line, it *does* work: >
>> sub postfix:<€> (Int $n) {2*$n}; say 42€
> 84 > > So this boils down to a much more generic issue, for which we already have tickets I believe. >
>> On 15 Aug 2017, at 14:25, Patrick Tonnerre (via RT) <perl6-bugs-followup@perl.org> wrote: >> >> # New Ticket Created by Patrick Tonnerre >> # Please include the string: [perl #131900] >> # in the subject line of all future correspondence about this issue. >> # <URL: https://rt.perl.org/Ticket/Display.html?id=131900 > >> >> >> Hi, >> >> context is : >> MBP running macOS Sierra 10.12.6 >> RakudoStar dmg installed >> This is Rakudo version 2017.07 built on MoarVM version 2017.07 >> implementing Perl 6.c. >> >> When executing the following commands under REPL, i got that issue :
>>> sub postfix:<€> (Int $n) {2*$n};
>> sub postfix:<€> (Int $n) { #`(Sub+{Precedence}|140257667062944) ... }
>>> say 21€
>> ===SORRY!=== Error while compiling: >> Bogus postfix >> ------> say 21⏏€ >> expecting any of: >> infix >> infix stopper >> postfix >> statement end >> statement modifier >> statement modifier loop >> >> Running the same statements into a script is working fine : >> #!/usr/bin/env perl6 >> >> sub postfix:<€> (Int $n) {2*$n} >> >> say 21€; >> >> ./operators.pl6 >> 42 >> >> Regards >> — >> Patrick
>
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Subject: Re: [perl #131900] [BUG] REPL issue defining new operator with Euro symbol
Date: Wed, 16 Aug 2017 18:25:00 +0200
To: "Patrick Tonnerre (via RT)" <perl6-bugs-followup [...] perl.org>
Download (untitled) / with headers
text/plain 1.7k
Further datapoints: $ perl6 To exit type 'exit' or '^D' Show quoted text
> sub postfix:<€> (Int $n) {2*$n}; say 42€
84 Show quoted text
> say postfix:<€> (42)
84 So, the sub *does* survive from one call to the next. It only loses the grammar adaptations that defining a sub postfix:<> do. Show quoted text
> On 15 Aug 2017, at 21:06, Elizabeth Mattijsen <liz@dijkmat.nl> wrote: > > This appears to be forgetfulness of the REPL from one input to the next. If you put it on the same line, it *does* work: >
>> sub postfix:<€> (Int $n) {2*$n}; say 42€
> 84 > > So this boils down to a much more generic issue, for which we already have tickets I believe. >
>> On 15 Aug 2017, at 14:25, Patrick Tonnerre (via RT) <perl6-bugs-followup@perl.org> wrote: >> >> # New Ticket Created by Patrick Tonnerre >> # Please include the string: [perl #131900] >> # in the subject line of all future correspondence about this issue. >> # <URL: https://rt.perl.org/Ticket/Display.html?id=131900 > >> >> >> Hi, >> >> context is : >> MBP running macOS Sierra 10.12.6 >> RakudoStar dmg installed >> This is Rakudo version 2017.07 built on MoarVM version 2017.07 >> implementing Perl 6.c. >> >> When executing the following commands under REPL, i got that issue :
>>> sub postfix:<€> (Int $n) {2*$n};
>> sub postfix:<€> (Int $n) { #`(Sub+{Precedence}|140257667062944) ... }
>>> say 21€
>> ===SORRY!=== Error while compiling: >> Bogus postfix >> ------> say 21⏏€ >> expecting any of: >> infix >> infix stopper >> postfix >> statement end >> statement modifier >> statement modifier loop >> >> Running the same statements into a script is working fine : >> #!/usr/bin/env perl6 >> >> sub postfix:<€> (Int $n) {2*$n} >> >> say 21€; >> >> ./operators.pl6 >> 42 >> >> Regards >> — >> Patrick
To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Subject: [BUG] user-defined postfix operators don't work well in the REPL
From: Dan Zwell <dan [...] zwell.net>
Date: Sun, 17 Sep 2017 17:18:02 +0000
Download (untitled) / with headers
text/plain 686b
The following code works fine if run in a script or with `perl6 -e '...'`, but fails when run in the REPL:

class KG { has $.amount; }
sub postfix:<kg>(Numeric $amount) { KG.new(:$amount); }
say 10kg;

# Output from perl6 -e:
# KG.new(amount => 10)

# Output from the REPL is:
# ===SORRY!=== Error while compiling:
# Confused
# ------> say 10⏏g;

Interestingly, if a postfix operator like this is exported by a module which is loaded by the REPL, the REPL can successfully parse that operator just once, after which it will fail with an error similar to the above.

I'm using Rakudo version 2017.08-96-ge5a600997 built on MoarVM version 2017.08.1-135-ge86428d4 implementing Perl 6.c.


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