wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

In the Python generator, create aliases for numeric types

Open esoterra opened this issue 3 years ago • 0 comments

When users are consuming generated code in Python, they are not able to tell which integer type a given int was or what size a float was. We can make this somewhat easier by introducing aliases for used numeric types that preserve that type info.

e.g.

def foo(a: int) -> int:
   ...

becomes

s32 = int
s64 = int

def foo(a: s32) -> s64:
   ...

esoterra avatar Jun 15 '22 20:06 esoterra