Open Mercerenies opened 1 year ago
Current behavior is to just assume we have the right number of arguments. So, for instance, if you gave Rect2
three arguments, the fourth would get filled in with null
automatically.
Related note: We've encountered this problem with yield
before (#5), which can take zero or two arguments. We didn't need to deal with it then because it turned out that yield
made more sense as a special form (which can do its own ad-hoc validation of arguments at compile-time).
GDLisp currently supports required arguments, optional arguments, and "rest" arguments. Putting aside the issue of named arguments (#55) for the moment, this means that, in GDLisp, the "correct" number of arguments with which to call a function is always a (potentially infinite) interval. A function like
can be called with anywhere from 2 to infinity arguments. A function like
can be called with anywhere from 2 to 4 arguments.
Unfortunately, a handful of GDScript built-in functions are not compatible with this interface.
Rect2
takes two or four argumentsQuat
takes one, two, or four argumentsTransform
takes one, two, or four argumentsColor
takes one, three, or four argumentsHow do we handle these?