3 ms·
I'm now largely out of my depth, but much of that will just come down to what is available from Nim and what is available from C? And perhaps some of it from th
by maxerickson 11y ago
I'm now largely out of my depth, but much of that will just come down to what is available from Nim and what is available from C? And perhaps some of it from the complexity of supporting arbitrary C code in a flexible way?
The Cython wrapper code is still pretty trivial compared to the C code ( https://github.com/fragglet/c-algorithms/blob/master/src/queue.c https://github.com/fragglet/c-algorithms/blob/master/src/que... ), and this is a pretty small piece of C.
- jboy 11y agoOh absolutely, Nim should definitely get the vast majority of the credit. It's not just because Nim compiles to C; it's also due to Nim's powerful macro system, which: (1) allows me to define my own first-class pragmas such as `exportpy`; (2) supplies my pragma with a detailed & expressive AST of the Nim function onto which my pragma was annotated; (3) enables my pragma to auto-generate the C-API boilerplate code, and write it to disk as a newly-created C source file, all within the Nim compilation pass. Nim is a fantastic language, perfectly suited to this scenario. I merely spotted an opportunity. :)