4 ms·
Ok, I'll pass on CoffeeScript
- debacle 14y agoI don't get it?
- cheald 14y agoYou can't re-use a variable name inside a scope without clobbering the value of the variable outside of the scope. You can in Javascript via the `var` keyword. The issue's been beaten to death, and the consensus among the pro-Coffeescript crowd is that it's acceptable, because you shouldn't be shadowing variables anyway, and the consensus amoung the anti-Coffeescript crowd is that it's terrible because it removes control from the developer.
- debacle 14y agoThat's one of the stupidest things I've ever heard.
- __david__ 14y agoThat's because you didn't spend two hours the other night tracking down a bug caused by upgrading to the latest coffeescript in which they removed shadowing on loop variables. In a point release.
- debacle 14y agoI'm not sure what you mean by 'removed shadowing on loop variables,' but in general there's a reason that lexical scope exists - so variables can be reused. Why prevent variables from being reused?
- __david__ 14y agoIn coffeescript 1.3.1 this code: a = 3 b = -> for a in [6,7,8] c = a b() console.log(a) would print "3". In coffeescript 1.3.3 it prints "8". The solution is either to rename one of the 'a' variables or add `var a` in the b() function. Coming from C where I always (ok 99% of the time) do: for (int i=0; ...) the loop scoping rules in the 1.3.1 version of coffeescript felt natural. The 1.3.3 change feels stupid.
- zethraeus 14y agoBecause you can't shadow a variable? Sure. But how about because actually learning JavaScript is better than coding with training wheels?
- mistercow 14y agoCoffeeScript is not "coding with training wheels". To use CoffeeScript at all, you need to be strong in JavaScript first. I know JavaScript very well. I use CoffeeScript because I prefer getting work done to proving how manly I am.
- mistercow 14y agoIt's not perfect, but it's a hell of a lot better than how it works in plain JS.
- knowtheory 14y agoSo, this is just a "haters gonna hate" post, that a dude got his buddies to upvote in /new? :P Way to contribute to elevating the state of discussion on the internet.
- oinksoft 14y agoA title like this is not acceptable. Previous discussion: http://news.ycombinator.com/item?id=3379962 http://news.ycombinator.com/item?id=3379962
- lloeki 14y agoIn LiveScript [0]: foo = 1 fun = -> foo = 2 fun() alert(foo) #1 and foo = 1 fun = -> foo := 2 fun() alert(foo) #2 But I'm sure haters will find something to hate in LiveScript too. [0] http://gkz.github.com/LiveScript/#assignment http://gkz.github.com/LiveScript/#assignment
- pepve 14y agofoo = 42 to mean JavaScript's var foo = 42; foo := 42 to mean JavaScript's foo = 42; I adore this syntax, it's amazingly easy to read. Where can I get it?
- lloeki 14y agoIn LiveScript and CoCo.