I'm hijacking this thread. This thread is now about determining a syntax for functions declarations.
My plan to allow doing what you are describing is to use the Definitions resource that's been on Ism's plate for six centuries to allow declaring EDL functions.
Do we stick to C++ syntax, or somehow incorporate a function keyword?
ENIGMA handles its declarations manually, so we can do basically anything.
The benefit to using the function keyword is that it makes closures syntactically unambiguous. Consider [snip=js]function() { return 1.337; }[/snip]. I could easily enough coerce that for a type, but that isn't the point. The alternative is [snip=edl]double() { return 1.337; }[/snip], but [snip=edl]double()[/snip] already means "the default value of a double," which is 0d.
The hybrid alternative is a little uglier, but completely unambiguous: [snip=edl]function double() { return 1.337; }[/snip], or [snip=edl]function double my_script() { return some_double; }[/snip].
If these functions can't have return types, then there's no point to having them over scripts. So the question is, which do we want more: closures, or not having to use the function keyword?
An array type for [snip=edl][a,b,c][/snip] is in progress, by the way, HaRRi.
|