Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
[BUG] Variables declared in quasi blocks don't work in Rakudo
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
"Carl Mäsak"  
View profile  
 More options Nov 3 2012, 7:45 am
Newsgroups: perl.perl6.compiler
From: perl6-bugs-follo...@perl.org ("Carl Mäsak")
Date: Sat, 03 Nov 2012 04:28:48 -0700
Local: Sat, Nov 3 2012 7:28 am
Subject: [perl #115566] [BUG] Variables declared in quasi blocks don't work in Rakudo
# New Ticket Created by  "Carl Mäsak"
# Please include the string:  [perl #115566]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115566 >

<jnthn> r: macro infix:<pos-or>(*@asts) is assoc('list') { my $result =
@asts.pop; for @asts.reverse { $result := quasi{ {{{$_}}} > 0 ?? {{{$_}}}
!! {{{$result}}} } }; $result }; sub foo() { say "oops"; 4 }; say -5 pos-or
3 pos-or foo;
<p6eval> rakudo 2bb302: OUTPUT«3␤»
<jnthn> Using two of the month's new features together :P
<masak> that's pretty impressive.
<jnthn> Sadly, fixing the double evaluation exposes a bug.
<jnthn> r: macro infix:<pos-or>(*@asts) is assoc('list') { my $result =
@asts.pop; for @asts.reverse { $result := quasi { my \x = {{{$_}}}; x > 0
?? x !! {{{$result}}} } }; $result }; sub foo() { say "oops"; 4 }; say -5
pos-or 3 pos-or foo;
<p6eval> rakudo 2bb302: OUTPUT«Lexical 'x' not found␤  in  at
/tmp/tiE6e4uirM:1␤  in block  at /tmp/tiE6e4uirM:1␤␤»
<masak> "the double evaluation"?
<jnthn> masak: It evalutes the macro argument twice.
<jnthn> masak: Because I wrote it that way
<masak> oh!
<masak> (phew)
<jnthn> {{{$_}}} > 0 ?? {{{$_}}} !! ...
<masak> yes, each {{{}}} evaluates once.
<jnthn> And I wanted to just do it once, but when I try to stick it in a
temporary variable, it busts.
<masak> as above. I see.
<masak> maybe declaring variables in quasis doesn't work?
<jnthn> Seems so
<masak> r: macro foo { quasi { my $a = "OH HAI"; say $a } }; foo
<p6eval> rakudo 2bb302: OUTPUT«Cannot assign into a PMCNULL container [...]
* masak submits rakudobug


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »