Closed back2dos closed 8 years ago
Yes this will be awesome, but a bit hard for Raxe compiler (but doable). But this is one of my goals, because it is awesome and nice looking feature :)
confusing in my opinion, because you don't know what to expect from "set" method in your example. in the first version, you understand it takes a String, and a Function. The second one looks like two expressions unrelated to each other. imho, the goal should be: readable, concise and clear by glance. not just short. the programmer should be able to figure out what happens from the call site, instead of delving into the code that it leads to.
I already added this, but with this syntax:
script.variables.set("env") => {
get: do(key : String)
return Sys.getEnv(key)
end,
set: do(key : String, value : String)
Sys.putEnv(key, value)
end,
}
So with the =>
arrow from tink_lang.
Aw, man, I was so hoping for first class support! :-D
Would it be hard to insert the arrow automatically, e.g. if you encounter ){
?
Looking at example code I wish that this
Could be written as this:
While this doesn't work for arbitrary expression (without introducing weird ambiguity such as
foo.bar(4)-5
, which could be interpreted asfoo.bar(4,-5)
), it would be cool for blocks and also object literals, e.g.: