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

Macros bind to the static lexpad, surprising users, in Rakudo #3306

Open
p6rt opened this issue Jan 4, 2014 · 2 comments
Open

Macros bind to the static lexpad, surprising users, in Rakudo #3306

p6rt opened this issue Jan 4, 2014 · 2 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 4, 2014

Migrated from rt.perl.org#120928 (status was 'stalled')

Searchable as RT120928$

@p6rt
Copy link
Author

p6rt commented Jan 4, 2014

From @masak

<masak> p​: my %h; macro attr($key, $val) { quasi { %h{ {{{$key}}} } =
{{{$val}}} } }; attr("x", "OH HAI"); say %h<x>
<camelia> ..rakudo-parrot e32249​: OUTPUT«(Any)␤»
<masak> huh!
<masak> anyway, I think I know what's going on.
<masak> the assignment happens to a %h in the static lexpad.
<masak> not sure how to get at that %h to show it, though.
<masak> oh, hold on.
<masak> p​: my %h; macro attr($key, $val) { quasi { %h{ {{{$key}}} } =
{{{$val}}} } }; macro diag { quasi { say %h<x> } }; attr("x", "OH
HAI"); diag;
<camelia> ..rakudo-parrot e32249​: OUTPUT«OH HAI␤»
<masak> there we go.
<masak> to be perfectly honest, I'm not even 100% sure this behavior is *wrong*.
<masak> (because the runtime %h doesn't exist by the point the macro is invoked)
<masak> it's closure semantics, basically.
* masak submits rakudobug about %h being the static one, Justin Case

@p6rt
Copy link
Author

p6rt commented Apr 26, 2016

@coke - Status changed from 'new' to 'stalled'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant