Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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...:-)

rg0now


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-10-21 00:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (94 votes), past polls