Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: {Perl6} Macros and native compilation

by rg0now (Chaplain)
on Apr 11, 2005 at 12:42 UTC ( #446581=note: print w/ replies, xml ) Need Help??

in reply to Re^2: {Perl6} Macros and native compilation
in thread {Perl6} Macros and native compilation

In my understanding, you absolutely can do this with Perl 6 macros. If you want $foo to be avaluated at compile time, you just return a string as you did. Contrariwise, if you return a closure (maybe using the simple my macro this { self{$foo} } syntax?), you get "a generic routine that is to be immediately inlined, treating the closure as a template", such that "any variable not referring back to a parameter is left alone, so that your template can declare its own lexical variables, or refer to a package variable". This way, $foo will be evaluated at runtime...

But, as always with Perl 6, don't take my words for granted...:-)


Comment on Re^3: {Perl6} Macros and native compilation
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://446581]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2015-12-01 17:17 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (21 votes), past polls