coffeescript
coffeescript copied to clipboard
bind specialty?
Hi!
Can't compile
fn = (a, b, c) -> 'bar'
obj =
foo: fn.bind {}, 369, null
while
fn = (a, b, c) -> 'bar'
obj =
foo: fn.bind({}, 369, null)
is fine.
What can be the problem?
TIA, --Vladimir
It's rewriting it to { foo: fn.bind({}, 369) }, null Weird.
# Not Working
f = ->
obj =
s: f 1, null
f = ->
obj =
s: f 1, true
f = ->
obj =
s: f 1, undefined
# Even weird . . .
f = ->
obj =
s: f 1, null, 1
f = ->
obj =
s: f 1, true, 5
f = ->
obj =
s: f 1, undefined, 7
# Working
f = ->
obj =
s: f null, 1
f = ->
obj =
s: f true, 1
f = ->
obj =
s: f undefined, 1
The working scenario is when the reserved word that has "value" (true, null, etc.) is passed as first argument in a function in whose return value is passed in a property of an object.
Fixed in 1.6.0.