Class double-bind

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Mar 5 16:13:47 UTC 2015


On Mar 5, 2015, at 2:52 AM, Erik Arvidsson wrote:

> Traceur does not give any history on this but I also remember having this discussion in a f2f meeting. It was all about "js has always been mutable, lets not change that. If you want immutability you have it with `const f = class {}`".

I think that's pretty much it.  Plus I think there was particular concern about the script global scope and the expectation that globals defined by one script should be patchable by another.

But perhaps our insight in these matters have evolved since then.

Editorially it would be a trivial change to make class declaration produce immutable bindings.  But if we were going to decide that I'd prefer that we achieved  TC39 consensus on the matter within the next week , so the changes could be made before the March meeting.  Does anybody want to try to champion this through that process?

Allen


> 
> On Thu, Mar 5, 2015 at 9:51 AM Andreas Rossberg <rossberg at google.com> wrote:
> On 5 March 2015 at 04:57, Brendan Eich <brendan at mozilla.org> wrote:
> Allen Wirfs-Brock wrote:
> This is novel weirdness.
> 
> In C++/Java/C# etc. you don't see it because the corresponding declarations create immutable bindings. I agree that it would have been nice of we could have done that.
> 
> Why could we not have?
> 
> I asked this up-thread. What was the rationale for let not const binding via class declarations? I honestly do not remember us considering const. Did we just "default" into let because of the historical (var) default binding form being mutable? If so, is it really too late?
> 
> I seem to remember a (brief) discussion about this, where the main argument for mutable was that it was "natural" for JS. Allen probably remembers more of the details.
> 
> It would be totally awesome if we could still correct this.
> 
> /Andreas
>  
> 
> Cc'ing Arv in case he can check via Traceur telemetry whether anyone counts on let-not-const from class.
> 
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150305/1cfd0c99/attachment.html>


More information about the es-discuss mailing list