As with #494 and #499, Kipper aims to support built-in generics and auto-inferred types, which should allow for more complex operations in the language.
This issue more specifically aims to target the topic of a generic function type, which is necessary for saving functions as values in variables and similar. So for example:
def fun(arg1: num) -> str {
// ...
}
// Auto-inferred type when referencing the value
fun; // -> Func<num, str>
// Assignability of a function to a variable
var x: Func<num, str> = fun; // -> Func<num, str>
// Calling the function from the variable
x(1); // -> str
Exact behaviour / changes you want
[x] #494 (Required for this issue)
[ ] Internal generic function type which takes any amount of function parameter arguments and takes one return value.
[ ] High-Level Func<P..., T> generic type, which the user can use to specify a generic function.
[ ] Integration with existing function call functionality.
Is there an existing proposal for this?
This feature does not exist in the latest version
Proposal
As with #494 and #499, Kipper aims to support built-in generics and auto-inferred types, which should allow for more complex operations in the language.
This issue more specifically aims to target the topic of a generic function type, which is necessary for saving functions as values in variables and similar. So for example:
Exact behaviour / changes you want
Func<P..., T>
generic type, which the user can use to specify a generic function.