JSAbrahams / mamba

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

Handle varargs in function signatures #179

Open JSAbrahams opened 4 years ago

JSAbrahams commented 4 years ago

Current Issue

The type checker currently cannot handle varargs

High-level description of the feature

Treat varargs as iterables by checking that they define the __iter()__ method

Description of potential implementation

Check that vararg arguments define the __iter()__ method. Treat these variables are iterable of the argument type.

def f(integers: *Int) => 
    # integers has type set_iterator[Int]
    # integer has type Int
    for integer in integers do print integer + 10