3 ms·
Roll your own JavaScript lambda syntax
- DanielRibeiro 16y agoCoffeescript has a much better syntax. Actually it has two much better syntaxes, one with a common semantics: a closure that captures the value of self (which is the default one in ruby/smalltak/python/scala, etc).
- _srobertson 16y agoWow, that looks great. Totally missed it when searching for precedents. I can still see myself using a preprocessor when dealing with small-to-moderate chunks of JavaScript, since it's so easy to drop into an existing framework, but I'll definitely be checking out Coffeescript for any larger JS applications.
- DanielRibeiro 16y agoCoffeescript is also great for being terser, making it dead simple to create classes (with executable bodies like ruby) and setup prototype inheritence, for comprehensions, for each iterations, and pattern matching. Also, the generated javascript code is very easy to read. I've replaced all my JS for coffee for 3 months (even making a firefox plugin with it) and never looked back.
- netghost 16y agoAlternatively there is also Oliver Steele's functional javascript which is neat: http://osteele.com/sources/javascript/functional/ http://osteele.com/sources/javascript/functional/