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

ECMAscript v5/Strict complience #566

Closed
AlyxRen opened this issue Aug 3, 2010 · 14 comments
Closed

ECMAscript v5/Strict complience #566

AlyxRen opened this issue Aug 3, 2010 · 14 comments

Comments

@AlyxRen
Copy link

AlyxRen commented Aug 3, 2010

ES5/Strict requires that you put at the top of the function call the string literal "use strict";
While theres only one current implementation of strict mode ( http://besen.sourceforge.net/ ),
it would be useful to allow the parser to check if the first line of your coffee is the string "use strict" and place it above all the var declarations in the final converted js

@jashkenas
Copy link
Owner

Hmm. Instead of forcing people to litter their code with "use strict" at the top of every file, perhaps CoffeeScript should add "use strict"; to every output file automatically, once there are enough browsers / runtimes supporting it. Is there ever a situation where you wouldn't want strict mode in CoffeeScript, given that it makes the execution of your code a good deal faster?

@AlyxRen
Copy link
Author

AlyxRen commented Aug 9, 2010

That makes perfect sense.

@jashkenas
Copy link
Owner

Great, closing this ticket for the time being. We'll re-open it / implement it when browsers are ready.

@AlyxRen
Copy link
Author

AlyxRen commented Aug 11, 2010

Sounds like a plan, I'll update when browsers trickle in support for strict mode.

@banksJeremy
Copy link

Chrome, Safari and Firefox now support strict mode, and Internet Explorer 10 will as well. Is this worth doing now?

@michaelficarra
Copy link
Collaborator

Strict mode support isn't exactly complete in current engines, but it's a lot better than last year, so re-opening. Related: #1547 and #1534.

@paulmillr
Copy link

👍 (+1)

@tpetry
Copy link

tpetry commented Sep 22, 2011

+1 for automatic strict mode compilation for every CS-File

@jashkenas
Copy link
Owner

Turns out that strict mode doesn't actually enable any code optimizations in current generation browsers ... it adds extra checks that make it slower, if anything. Closing as a wontfix until strict mode start showing benefits.

@michaelficarra
Copy link
Collaborator

I predict we will be waiting around another year for the browsers to actually execute strict mode code quickly. sigh...

@vinyll
Copy link

vinyll commented May 3, 2013

ok, 2 years for now. strict mode is in. +1 to go for it

@vendethiel
Copy link
Collaborator

I think it's faster now :).

@vendethiel vendethiel reopened this May 3, 2013
@hden
Copy link
Contributor

hden commented May 8, 2013

👍

@GeoffreyBooth
Copy link
Collaborator

See 2337.

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

10 participants