Re: [Cython] [ENH] Compile-time code execution (macros / templates)

2021-02-28 Thread Celelibi
Hm. If I understand correctly what you want is to generate attributes at compile-time and then get all the benefits of having statically declared attributes at run-time. This looks like a very interesting use-case. I guess it's a kind of named tuples with custom methods. The syntax you propose is

Re: [Cython] [ENH] Compile-time code execution (macros / templates)

2021-02-27 Thread Celelibi
nd other such tools a lot. And I have to say I'm not really a big fan of that kind of trickery. If a coding pattern would fool grep + a brain, other analysis tools were lost eons ago. But if you have an actual use case for AST manipulation that would belong to a pre

Re: [Cython] [ENH] Compile-time code execution (macros / templates)

2021-02-26 Thread Celelibi
would have to be aware of the AST at all. I mean, if you have a good use-case for it, then I'm ok with allowing the compile-time code manipulating it. But I'd really prefer this not be the main use of the compile-time execution feature. Greg Ewing, > On 26/02/21 3:21 pm, Celelib

Re: [Cython] [ENH] Compile-time code execution (macros / templates)

2021-02-25 Thread Celelibi
Le Fri, Feb 26, 2021 at 01:32:34PM +1300, Greg Ewing a écrit : > On 26/02/21 9:29 am, Celelibi wrote: > > Maybe in the future if cython > > support compiling closures to C? > > Your "twice" example already needs some closure functionality. Yes, at the python level o

Re: [Cython] [ENH] Compile-time code execution (macros / templates)

2021-02-25 Thread Celelibi
ned object into the AST. All the remaining (non-CTFE) code would be converted to code that build the AST. I hope that makes it more clear. Celelibi Le Wed, Feb 24, 2021 at 10:20:39PM +, da-woods a écrit : > A few things to point out: > 1) Because Cython is mainly a is code tran

Re: [Cython] [ENH] Compile-time code execution (macros / templates)

2021-02-24 Thread Celelibi
AST. But it doesn't mean the AST itself has to be visible. Best regards, Celelibi ___ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel

[Cython] [ENH] Compile-time code execution (macros / templates)

2021-02-23 Thread Celelibi
cdef dostuff(): return 0 What do you think? Did I miss something that would make this feature mostly useless? Best regards, Celelibi ___ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel