Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
telemachos
· 14y ago · 0 comments
Now that both
?=
and
or=
throw errors with an undefined variable, is there another idiomatic way to write Ruby's
||=
in CoffeeScript?
Comments
[–]
jashkenas
14y ago
If you want the previous global behavior (make sure you're on 1.3.1) ... explicitly say you're making a global:
window._ or= require "underscore"
[–]
telemachos
OP
14y ago
Thanks.
[–]
wc7
14y ago
I am not sure if this directly addresses your issue or not, but check out this reply to the article (1.3.1 just released to fix a problem undeclared globals and or= )
http://news.ycombinator.org/item?id=3824543