Hi. I'm new here. This is my first post. I've been working on a reactive-programing library in Angel-Script (as in games you usually want to do temporal sequences of events) , that makes heavy use of functional-programing style. Based on my limited experience with the language and this project, I'd like to offer the following suggestion:
funcdef int int_function(int);
funcdef int void_function();
int counter(int_function @a){return a(0);}
int counter(void_function @a){return a();}
Consider the following 3 possible lines of code:
int b = counter(function(int c){return c;});
It would be wonderful if this worked from the get-go, but the compiler considers this ambiguous. It gives multiple matching signatures to 'counter($func@const)
error.
int b = counter(int_function(function(int c){return c;}));
This looks nice (enough), and should work, but doesn't. The error is: No matching signatures to 'int_function($func@const)'
. I don't know how to define anything that has that signature.
int b = counter(cast<int_function>(function(int c){return c;}));
This finally works, but feels cumbersome to write.
Conversion of anonymous functions to their intended function signatures should be easier. You can usually tell what signature it's “supposed” to have by looking at the types of their arguments and return values.