Currently, in hscript, and in Haxe itself, you can declare an anonymous structure to contain various functions with the function keyword:
var obj = {
myFunc: function() {
// do something
}
}
However, even though this may be my impatience talking, I would rather like a short-hand version of this which would only be available in the context of an anonymous structure, like so:
var obj = {
myFunc: () {
// do something
}
}
Where the parentheses before the curly brace indicates a function declaration rather than an object declaration if the parentheses were omitted. This could also apply in Haxe itself. I haven’t followed the Haxe 4.0 compiler features all that much, so maybe this is already in the plans, although I am curious what people think of this. Could this be a thing that happens in hscript (for which I would be happy to contribute a pull request) or perhaps be part of the core Haxe language as well? Thoughts?
Thanks.