Dag Sverre Seljebotn wrote:
> Martin C. Martin wrote:
>> Ok, thanks a lot.
>>
>> My day job is programming Lisp, and since I started two years ago, 
>> I've seen the light about a number of things, including macros.  It 
>> would be cool to have access to the Abstract Syntax Tree of a Cython 
>> expression/statement/function/etc., and be able to manipulate it at 
>> compile time.  But it sounds like that's a whole other project.  :)
> Hmm. I'm still not sure whether I've come across right :-)
> 
> Accessing the abstract syntax tree is exactly what this is about, and 
> you can do that (however the syntax for doing would seem rather complex 
> and messy compared to with LISP, though a lot better I believe than what 
> has been going on until now).
> 
> The problem is that the code that accesses the syntax tree has to be 
> written in Python and inserted into the compiler at launch time -- you 
> cannot analyse yourself.

So, how hard would it be to provide a mechanism to do this in the same
file?  There's a large subset of use cases for Lisp's macros which need 
the &body parameter.  To do the equivalent in Python/Cython, you'd need 
a way to specify a block of code, much like a closure that doesn't take 
any parameters.  Interesting...

Best,
Martin
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to