|
|
|
|
|
by jacktoole1
4797 days ago
|
|
I've used moonscript a lot, and don't particularly like the \ syntax. However, you get used to it quickly, and it stops seeming like such a big deal. It would be hard to have both be '.', because of lua semantics: '.' means "get the property from the table", while ':' in lua and '\' in moonscript mean "get the function from this table, with the first parameter for that function bound to the table itself". Javascript/Coffeescript can get away with both being '.' because of the horrible mess that is implicit 'this'. All functions have an implicit first parameter, that non-method functions usually ignore, and '.' in javascript does the equivalent of ':' and '\' in moonscript (for functions). I find the lua approach much simpler and cleaner, and think it is actually more approachable than the javascript way, because the difference between '.' and ':' or '\' is conceptually simpler than all the rules behind 'this' in javascript. Programming in Lua explains ':' in http://www.lua.org/pil/16.html , and probably has a better explanation that I wrote :). |
|