jashkenas/coffee-script — Issue #2145: string interpolated parameter generates different function call
Author: jzimmek
Created: 2012-02-27 01:59:54+00:00
State: open

coffescript generates the following code:

source:

fun "hello"
bla: "blub"

compiled:

fun("hello", {
bla: "blub"
});

but using string interpolation we get a different result

source:

fun "hello#{i}"
bla: "blub"

compiled:

fun(("hello" + i)({
bla: "blub"
}));

it is no big deal, cause i can work around this by appending a "," after the first parameter. but the code without "," is nicer and can be read more fluent.

is this the expected behaviour or kind of a bug ?