JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

Preserve types as type hints #121

Closed JSAbrahams closed 4 years ago

JSAbrahams commented 5 years ago

Current Issue

Types were thrown away for the sake of keeping the desugar stage simple. However, Python has type hints, which is also ideal for making pseudo-interfaces such as #120 . We should make use of such interfaces.

High-level description of the feature

Desugar types in Mamba to the relevant types in Python. Primitive types, such as Int and String should be desugared, but also generics and containers such as Tuples.

Extra care should be taken when implementing generics.

Description of potential implementation

Need to check where types may be in Python. Personally, I've only seen these as part of variable definitions and function arguments, so we should probably only desugar these in those specific cases and not top-level.