On 26/02/21 3:21 pm, Celelibi wrote:
def twice(f):
fun = CdefFunction(... use f ...)
return fun
foo = CdefFunction(...)
ast.append(AstCdefFunction("foo", twice(foo)))
I think this might even be doable without having to even detect the
closure in cython. We'd just have to let python pe
Celelibi wrote:
> def twice(f):
> fun = CdefFunction(... use f ...)
> return fun
>
> foo = CdefFunction(...)
> ast.append(AstCdefFunction("foo", twice(foo)))
Doesn't this just punt on how CdefFunction works? Feels like we're
back to AST re-writing.
--
Warm Regards
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 only. That's precisely the point.
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.
It relies on being able to manufacture a cdef function inside
a Python function, with the expectation that it will have
access to ar
1) My suggestion would only run some standard python code during the
compilation. Running the cdef functions at compile-time doesn't have to
be supported. At least not for a first version.
Even if it gets supported, calling external functions (written in C)
doesn't have to be supported either. If
1. I'm not sure why there would be any dependency on a C compiler in
either mine or Celelibi's proposal. Could you please elaborate? At
least in my proposal, we only ever go from Cython AST to Cython AST
and use Python to do it. None of these things require a C compiler.
To me it looked like Ce