domenic at domenicdenicola.com (2014-01-06T13:50:20.376Z)
I know SpiderMonkey was doing that and yes, too many topics here, apologies. I just wanted to understand the rational for not having that behavior since I would not define a const inside a for loop but maybe somebody would do that. Anyway, got it, nothing will change, it would be very cool to think about improving try/catch logic in any case, but that's another topic.
I know SpiderMonkey was doing that and yes, too many topics here, apologies. I just wanted to understand the rational for not having that behavior since I would not define a const inside a for loop but maybe somebody would do that. Anyway, got it, nothing will change, it would be very cool to think about improving try/catch logic in any case, but that's another topic. Best Regards On Fri, Dec 20, 2013 at 2:04 PM, Brendan Eich <brendan at mozilla.com> wrote: > Andrea Giammarchi wrote: > >> I am suggesting that const should: >> >> 1. reserve the const name for the whole scope (similar to var) >> 2. if assigned, keep that value and throw if re-assigned >> 3. if not assigned, having the very first assignment "seal the deal" >> >> and throw to any other re-assignment attempt >> >> > SpiderMonkey's primordial const (from 1999? I forget) was like this, > except (pre-strict-mode) no throw on reassignment attempt, just silent > failure. However it had quirks, e.g.: > > // K in scope here, hoisted with value undefined > for (var i = 0; i < N; i++) { > const K = i*i; > ... > } > // K still in scope here, like hoisted var > > So you could see more than one value for a constant (due to hoisting, and > if the assigning initialiser was in a loop). > > TC39 voted "no" long ago. We are not going to do anything like your 1-3 > list. Sorry. > > Also, I think you are still barking up the wrong tree -- your issue is not > const but a var that you can make non-writable after some fiddling -- which > wants Object.defineProperty. > > You are also mixing independent issues such as experimental feature > detection, which is not a burning issue (as Claude said, stop supporting > downrev browsers and browser vendors will stop putting experimental > features in product release channels). > > Please stick to one topic per thread if you can. I understand when they > get tangled, but once untangled, don't rehash or go in circles. > > /be > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131220/7fbcc9b2/attachment-0001.html>