hpy
hpy copied to clipboard
Compatibility with non-C languages
It would be great if the API could (at least as an alternative) stick to "normal" functions, i.e. no vararg, no macros and no global variables.
In particular, there should at least be an alternative to HPyArg_Parse
with a signature like
int HPyArg_Parse2(HPyContext ctx, HPy *args, HPy_ssize_t nargs,
const char *fmt, void** targets);
Also, there could be a set of functions to get the constants:
HPy HPyConst_None();
Lastly, there doesn't seem to be a way to define modules and methods "programmatically" right now. Even if this is less efficient, it would nevertheless help a lot.
The reason I'm asking for these things is my involvement with pythonnet, which currently has to translate the C macros manually to C#, with the obvious possibility of breakage down the line and an annoying version-dependence. Also, .NET's P/Invoke mechanism (like, I guess, many FFI implementations) only really supports access to functions, and only to those without varargs. Varargs have the addtional annoying property, that they are ABI-dependent, so we'd have to model that per platform as well.