Dictu icon indicating copy to clipboard operation
Dictu copied to clipboard

[FEATURE] List unpacking for function args

Open Jason2605 opened this issue 4 years ago • 0 comments

Is your feature request related to a problem?

Look into unpacking for functions, to begin with just list unpacking that map to positional arguments. We can look into this again if/when keyword arguments are ever implemented and extend this with dictionary unpacking.

Describe the solution you'd like

Similar implementation to python:

def test(a, b, c) {
    print(a, b, c);
}

test(*[1, 2, 3]);

test(1, *[2, 3]); // Can pass positional arguments too

Describe alternatives you've considered

We could consider a different operator, much like JSs spread, .... Not massively fussed about this.

Jason2605 avatar Oct 02 '21 19:10 Jason2605