Use ...
of a variadic function in "normal" function
#873
Labels
semantics
Unexpected or unsound behaviors
...
of a variadic function in "normal" function
#873
Use-case: Writing a variadic function wich uses a binary function to reduce its arguments.
Example:
(playground currently not showing the error until I do a change like removing and adding one parenthesis for example).
I'm not sure if this always should compile as
...
might be more/less than (in this case) two values, but commonly it is guarded (viaselect('#', ...)
) that the argument count is>=
(and usually in lua the additional arguments are just discarded).As I think about this while writing this, maybe this is not quite a bug report but more seeking for guidance how to write something like this in current teal (just upgraded from
0.15.3
where the above was still working) and maybe a feature request (still not sure how to make this work in a type-safe manner though).For now the only alternative I'm aware of is putting
...
in a table (this is not safe in casenil
is involved though) and then access as an array.The text was updated successfully, but these errors were encountered: