You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When passing a function as a higher-order parameter I can only reference it by name, e.g:
higherOrderFunction(parameterFunction);
The problem is when parameterFunction is overloaded with multiple different argument arities. In this case the
type of parameterFunction is not a function anymore (the least upperbound of functions with different arities is value), so the code does not type-check.
Describe the solution you'd like
We could add a syntax and semantics for referencing functions by name + arity. Examples:
The last example would also filter out overloaded alternatives with parametertypes which are not intersecting with int and int, respectively, but that is more than I'm asking for here. Although it would be the most general thing we can think of to reference specific function alternatives from a set... so there's that.
Describe alternatives you've considered
Leaving it as is. The problem with that is that you'd have to take care not to overload with different arities if you want your functions to be reused in higher-order settings. That's not ok. Overloading is particularly useful when arities are different. You don't have to come up with new names.
The text was updated successfully, but these errors were encountered:
@PaulKlint@tvdstorm this is a small future enhancement; I think it would close the circle regarding the simplification process of the type-system regarding (higher-order) function types. There exists no more (complex) union type for functions (overloadedfunctiontype), and this is one of the final issues that remains in order to clean up after it.
Current workaround is to rename functions with different arities :-(
Is your feature request related to a problem? Please describe.
When passing a function as a higher-order parameter I can only reference it by name, e.g:
The problem is when
parameterFunction
is overloaded with multiple different argument arities. In this case thetype of
parameterFunction
is not a function anymore (the least upperbound of functions with different arities isvalue
), so the code does not type-check.Describe the solution you'd like
We could add a syntax and semantics for referencing functions by name + arity. Examples:
The last example would also filter out overloaded alternatives with parametertypes which are not intersecting with int and int, respectively, but that is more than I'm asking for here. Although it would be the most general thing we can think of to reference specific function alternatives from a set... so there's that.
Describe alternatives you've considered
Leaving it as is. The problem with that is that you'd have to take care not to overload with different arities if you want your functions to be reused in higher-order settings. That's not ok. Overloading is particularly useful when arities are different. You don't have to come up with new names.
The text was updated successfully, but these errors were encountered: