Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong JavaScript output ? #3619

Closed
wangkechun opened this issue Aug 28, 2014 · 2 comments
Closed

wrong JavaScript output ? #3619

wangkechun opened this issue Aug 28, 2014 · 2 comments

Comments

@wangkechun
Copy link

a(b).c() + 'a' + c generate a(b).c() + 'a' + c;
but a(b).c() +'a' + c generate a(b).c()(+'a' + c);

@connec
Copy link
Collaborator

connec commented Aug 28, 2014

Duplicate of many other tickets (though goodness knows what to search for?).

CoffeeScript sees an implicit function call in console.log +'123' because it treats it as
console.log (+'123') (compare to JS, which gives you "function log() { [native code] }123").

It is a little weird, though, that it is sometimes allowed: console.log +'123' +'456' compiles to console.log(+'123' + '456'), rather than the syntax error you would get for
console.log +'123' (+'456').

@KamilaBorowska
Copy link

It would be issue #1036.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants