Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://446581]
help
Chatterbox?
[Discipulus]: echo 'a'\'' gives me the prompt and then go with error on ctrl-d
[Discipulus]: uch! worst than windows!

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2017-11-24 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (346 votes). Check out past polls.

    Notices?