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 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 semicolons" argume

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 we

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 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. >> >> http://www.google.com/codesearch?q=%5Cx20%5Cx

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 > sho

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 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 make "web ap

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

2011-04-19 Thread Mike Samuel
2011/4/19 Bob Nystrom : > On Mon, Apr 18, 2011 at 7:46 PM, Mike Samuel 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 not at the beginning of the n

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 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 as a complaint. I

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

2011-04-19 Thread Mike Samuel
2011/4/19 Bob Nystrom : > On Mon, Apr 18, 2011 at 7:46 PM, Mike Samuel 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 think there > were

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

2011-04-19 Thread Brendan Eich
On Apr 19, 2011, at 10:41 AM, Bob Nystrom wrote: > On Mon, Apr 18, 2011 at 7:46 PM, Mike Samuel 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'

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

2011-04-19 Thread Bob Nystrom
On Mon, Apr 18, 2011 at 7:46 PM, Mike Samuel 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 think there were cases where a ";" is valid after a ":

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 (u

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

2011-04-18 Thread Mike Samuel
2011/4/18 Bob Nystrom : > 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 (;;) {} would be in

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

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

2011-04-18 Thread Brendan Eich
On Apr 18, 2011, at 12:32 PM, Isaac Schlueter wrote: >> Indentation, yay. Necessary in your view, or could you just ignore >> everything except the separation by a line terminator? > > Thinking about this a bit more, I think maybe this whole suggestion is > a bad idea. Forget I said anything.

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 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 rest of my life.  I

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

2011-04-18 Thread Brendan Eich
On Apr 18, 2011, at 12:14 PM, Isaac Schlueter wrote: > [snip, and huzzah! ;-)] > Furthermore, it is not the existence of ASI, but rather the lack of it > that causes problems even more frequently than the restricted > productions issue. > >var a = 1; >var b = 2; >var c = { foo : "bar

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 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 > semicolons (i

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 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 my opinion. The "

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

2011-04-18 Thread Brendan Eich
On Apr 18, 2011, at 5:09 PM, Lasse Reichstein wrote: > On Mon, 18 Apr 2011 14:42:21 +0200, Jorge 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 ! > > ... and that's actual

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 https://mail.mozilla.org/listinfo

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 po

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 17, 2011, at 8:33 PM, Mike Ratcliffe 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 semicolo

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

2011-04-18 Thread Lasse Reichstein
On Mon, 18 Apr 2011 14:42:21 +0200, Jorge 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 ! ... and that's actually a very relevant point. Errors with ASI comes (in my experience) exclusivel

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 d

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 tod

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 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 why would anyone w

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 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 ___ es-discuss mailing lis

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 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 t

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 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 occur. I have

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

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

2011-04-17 Thread Garrett Smith
On 4/17/11, Allen Wirfs-Brock 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 would welc

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 rea

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

2011-04-17 Thread Garrett Smith
On 4/17/11, Mike Ratcliffe 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 semicolons. > > Now I am obs

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

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

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 wrote: > On Apr 17, 2011, at 10:52 AM, Claus Reinke wrote: [TLDR] > ASI is not going to be removed. I don'