Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Jorge
On 18/04/2011, at 16:37, Mike Ratcliffe wrote: Jorge, I would opt in for warnings e.g. if I planned on minifying my web app in the future. Most web apps will burn in hell if they are missing semicolons when you minify them. Indeed, for some minifiers it's a must. These minifiers avoid

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Mike Samuel
2011/4/19 Bob Nystrom rnyst...@google.com: On Mon, Apr 18, 2011 at 7:46 PM, Mike Samuel mikesam...@gmail.com wrote: If I understand semicolon elision, then myLabel: for (;;) {} would be interpreted as myLabel: ; for (;;) {} I'm still learning to details of the ES grammar, but I didn't

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Isaac Schlueter
On Tue, Apr 19, 2011 at 09:57, Jorge jo...@jorgechamorro.com wrote: Most web apps will burn in hell if they are missing semicolons when you minify them. Indeed, for some minifiers it's a must. Which minifiers? Closure, yuicompressor, jsmin, packer, and uglify all handle ASI without so much

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Mike Samuel
2011/4/19 Bob Nystrom rnyst...@google.com: On Mon, Apr 18, 2011 at 7:46 PM, Mike Samuel mikesam...@gmail.com wrote:  var x = foo    + bar That's true. I believe in languages that default to treating newlines as significant, the style is to put a binary operator at the end of the line and

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Jorge
On 19/04/2011, at 19:52, Isaac Schlueter wrote: On Tue, Apr 19, 2011 at 09:57, Jorge jo...@jorgechamorro.com wrote: Most web apps will burn in hell if they are missing semicolons when you minify them. Indeed, for some minifiers it's a must. Which minifiers? I don't know, the ones that

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Bob Nystrom
I think there are a large number of programmers who, because of those java style guidelines and the way ASI works, write javascript breaking before operators except for comma operators. http://www.google.com/codesearch?q=%5Cx20%5Cx20%5Cx20%5B%2B-%5D%5B ^%2B-%5D+lang%3Ajavascript shows

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread John Tamplin
On Tue, Apr 19, 2011 at 2:53 PM, Bob Nystrom rnyst...@google.com wrote: I think there are a large number of programmers who, because of those java style guidelines and the way ASI works, write javascript breaking before operators except for comma operators.

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Bob Nystrom
var a = 1 + 2 // a = 1 var a = (1 + 2) // a = 3 Ok, so you are advocating that adding extra parens is less typing and less prone to error than adding semicolons? Yes, adding extra parens where needed and omitting ; is less typing. To verify, I just went through a bunch of

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-19 Thread Isaac Schlueter
On Tue, Apr 19, 2011 at 11:53, Jorge jo...@jorgechamorro.com wrote: Which minifiers? I don't know, the ones that make web apps burn in hell if they are missing semicolons. Until someone can point to an actual minifier that's actually affected by this, I think the whole minification requires

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Peter van der Zee
On Mon, Apr 18, 2011 at 3:12 AM, Oliver Hunt oli...@apple.com wrote: An implementation _could_ add a mode (*shudder*) along the same lines as strict mode: die in hell ASI, i hate you with the fiery passion of a thousand burning suns.; And then make it a syntax error whenever ASI would

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Jorge
On 18/04/2011, at 09:52, Peter van der Zee wrote: On Mon, Apr 18, 2011 at 3:12 AM, Oliver Hunt oli...@apple.com wrote: An implementation _could_ add a mode (*shudder*) along the same lines as strict mode: die in hell ASI, i hate you with the fiery passion of a thousand burning suns.; And

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Peter van der Zee
On Mon, Apr 18, 2011 at 12:34 PM, Jorge jo...@jorgechamorro.com wrote: What am I missing ? As far as the directive goes, they are opt-in. Old code won't be opting in. Other than that they have the same issues as use strict might have. - peter ___

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Jorge
On 18/04/2011, at 13:10, Peter van der Zee wrote: On Mon, Apr 18, 2011 at 12:34 PM, Jorge jo...@jorgechamorro.com wrote: What am I missing ? As far as the directive goes, they are opt-in. Old code won't be opting in. Other than that they have the same issues as use strict might have. But

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread xcv3000
Hi Everyone, Just to add some out-of-the-browser perspective to the discussion, and since Node.js was mentioned by name in this thread, I believe it is important to note that the package manager for Node.js absolutely *depends* on the automatic semicolon insertion working just the way it works

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Mike Ratcliffe
Jorge, I would opt in for warnings e.g. if I planned on minifying my web app in the future. Most web apps will burn in hell if they are missing semicolons when you minify them. On 04/18/2011 02:42 PM, Jorge wrote: On 18/04/2011, at 13:10, Peter van

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Brendan Eich
See http://www.mail-archive.com/es-discuss@mozilla.org/msg05609.html and earlier posts in that thread, for where no asi; as a Harmony pragma was tossed out as possible syntax. The agreement we seemed to reach was simply to have a way for programmers to disable ASI, not try a complex new-ASI

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Brendan Eich
On Apr 18, 2011, at 12:24 AM, Garrett Smith wrote: Implementations are motivated to get scripts working and conform to specs. How could Ecma encourage developers to stop using ASI? I initially thought that standard warnings in strict mode would help. No. My earlier reply to your previous post

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread P T Withington
On 2011-04-18, at 13:48, Brendan Eich wrote: Do popular minifiers still not parse and insert semicolons (and remove newlines) as needed? Only the broken ones! :) ___ es-discuss mailing list es-discuss@mozilla.org

Fwd: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Isaac Schlueter
On Mon, Apr 18, 2011 at 05:42, Jorge jo...@jorgechamorro.com wrote: I understand that it would be quite interesting to get a warning/error in this case: a= b (c= d)(); ...only that there's no ASI in this case ! Jorge touches on the reason why the whole debate about ASI is a bit misguided, in

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Isaac Schlueter
On Mon, Apr 18, 2011 at 11:05, Brendan Eich bren...@mozilla.com wrote: Given the primary problem is not ASI but its absence where users expect it due to mistakenly believing a newline is significant, one could argue the fix is not to ban ASI and tax everyone with writing lots of insignificant

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Isaac Schlueter
On Mon, Apr 18, 2011 at 12:22, Brendan Eich bren...@mozilla.com wrote: I agree, but in a friendly spirit suggest typing ; is a tax too, however much lesser. True, I overstated.  It *is* a keyboard tax.  But (at least in my experience) I tend to type code in a moment, and then read it for the

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Bob Nystrom
However, given the reality of ASI, in practice there are two ways to terminate statements. Then the question becomes, what is more usable, optionally turning off ASI, or under prior opt-in to Harmony, improving ASI? I would love to be able to ditch my ; in JS. There are other languages that

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-18 Thread Mike Samuel
2011/4/18 Bob Nystrom rnyst...@google.com: The semicolon elision rules from what I've seen are a good bit simpler than the current insertion ones: If a token that can't end an expression or statement precedes a newline, eat the newline. If I understand semicolon elision, then myLabel: for

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-17 Thread François REMY
7:07 PM To: Brendan Eich Cc: es-discuss@mozilla.org Subject: Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives On 4/17/11, Brendan Eich bren...@mozilla.com wrote: On Apr 17, 2011, at 10:52 AM, Claus Reinke wrote: [TLDR] ASI is not going to be removed. I

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-17 Thread Mike Ratcliffe
To: Brendan Eich Cc: es-discuss@mozilla.org Subject: Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives   On 4/17/11

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-17 Thread Garrett Smith
On 4/17/11, Mike Ratcliffe mratcli...@mozilla.com wrote: I remember going over a few hundred thousand lines of JavaScript and adding semicolons because I had decided to minify it. I also remember that for months I was receiving bug reports from sections of code where I had missed the

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-17 Thread Allen Wirfs-Brock
On Apr 17, 2011, at 12:33 PM, Mike Ratcliffe wrote: ... Personally I would welcome some kind of option to disable ASI with open arms. Garrett's strict mode warning idea makes sense to me but I am fairly certain that not everybody would welcome it. ~ I'd suggest that this isn't really a

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-17 Thread Garrett Smith
On 4/17/11, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Apr 17, 2011, at 12:33 PM, Mike Ratcliffe wrote: ... Personally I would welcome some kind of option to disable ASI with open arms. Garrett's strict mode warning idea makes sense to me but I am fairly certain that not everybody

Re: Automatic Semicolon Insertion: value vs cost; predictability andcontrol; alternatives

2011-04-17 Thread Oliver Hunt
An implementation _could_ add a mode (*shudder*) along the same lines as strict mode: die in hell ASI, i hate you with the fiery passion of a thousand burning suns.; And then make it a syntax error whenever ASI would occur. I have considered this in JSC (albeit with a slightly shorter opt in