fable-compiler / Fable.Python

Python bindings for Fable
https://fable.io/docs/
MIT License
132 stars 9 forks source link

binding calls with argument names #91

Closed smoothdeveloper closed 1 year ago

smoothdeveloper commented 1 year ago

I'm not familiar with python nor with how the fable binding system works (starting to use with rust & python recently).

np.fromfile(filename,dtype=...)

for example, if this function takes many other arguments, or only accept named arguments, I'm not sure how to make proper binding for it on Fable side.

I've been struggling a bit with passing arguments to the functions that I want to get passed by name instead of just the position when writing binding in fable code.

Overall, I wondered if you'd consider, if the compiler supported it, this following F# compiler suggestion to enable this in the fable transpiler?

https://github.com/fsharp/fslang-suggestions/issues/414

I don't know how significant it is to adjust the code emit part of fable2py to take care of this, maybe we could port my PR of the suggestion into fable2py in a more direct fashion?

I think this would help with many apis if we could support this, and maybe we don't even need F# compiler to support it, beside we won't get the warnings (unless this is also possible to handle in fable2py).

@dbrattli @alfonsogarciacaro @dsyme

smoothdeveloper commented 1 year ago

Closing: seen [<NamedParams>] is part of Fable.Core and addresses my need in context of python target for this issue.