Unpacking tuples into function arguments (formerly "Variadic arguments") #257
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#257
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I was wondering, is variadic arguments something that will be supported in NAC3? This feature is currently not available, but I can imagine usecases for this.
Currently if you would run the following program
an error will be raised
As mentioned before, NAC3's type system requires type annotations on every function argument. How would you reconcile that with variadic arguments?
If you look at the way Python supports this:
https://peps.python.org/pep-0484/#arbitrary-argument-lists-and-default-argument-values
...all variadic arguments must have the same type. It sounds possible to implement that in NAC3 as it is merely syntactic sugar. But I'm not sure if this is what you want.
I think I might have phrased my question wrong. I am not interested in having function signatures with variadic arguments, I am interested in expanding sequences of values into the positional arguments of a function. So I would like the following to work in a kernel:
Sounds possible - and we support non-homogeneous tuples, so there wouldn't be additional type restrictions there.
Variadic argumentsto ~~Variadic arguments~~ Unpacking tuples into function arguments~~Variadic arguments~~ Unpacking tuples into function argumentsto Unpacking tuples into function arguments (formerly "Variadic arguments")