Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
Don't ask to ask, just ask
 
PerlMonks  

Re^4: How to get code of the calling function or object

by nikosv (Hermit)
on Mar 25, 2011 at 10:47 UTC ( #895443=note: print w/ replies, xml ) Need Help??


in reply to Re^3: How to get code of the calling function or object
in thread How to get code of the calling function or object

directly to modify the AST of a subroutine on the fly

I think the issue is that Perl produces an optree rather than an abstract syntax tree;the optree directly represents Perl's concrete syntax while with an AST you have a more abstract view

I am under the impression that Perl 6 as well as the other languages for Parrot will output ASTs which will map onto a Parrot Abstract Syntax Tree.

One main reason for that is tree transformation/manipulation which allow things that the OP asked for

The .NET DLR is a an example of that.It calls the DLR AST as Expressions, which is represented by an intermediate Expressions language;this allows for a myriad of neat tricks.You might want to check Expression Tree Basics


Comment on Re^4: How to get code of the calling function or object

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-04-21 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (491 votes), past polls