Scoped binding of a method to an object

Brendan Eich brendan at mozilla.com
Mon Oct 14 11:06:37 PDT 2013


> Allen Wirfs-Brock <mailto:allen at wirfs-brock.com>
> October 14, 2013 10:52 AM
>
> I'm not sure I buy your "Smalltalk has nominal class types" assertion,

I defer to your Smalltalk expertise :-P. However, there's nothing I know 
of that allows unrelated class definitions to be related by the subclass 
relation. Right?

In ES6, due to Object.setPrototypeOf/__proto__, two unrelated classes 
can become related in a dynamic fashion.

> but Smalltalk does generally process class definitions as a complete 
> unit and certain dynamic changes to a class definition can cause the 
> complete reprocessing (eg, recompiling methods from source) of a class 
> and all of its subclasses (and the dynamic mutation of all existing 
> instances of those classes!) to match the revised definition. The 
> reprocessing can also fail if the change introduces any 
> inconsistencies such as deleting instances variables that are still 
> referenced by methods.
>
> I believe that classboxes depends upon this reprocessing step to 
> maintain its invariants.

My point!

/be
>
> Allen
> Brendan Eich <mailto:brendan at mozilla.com>
> October 14, 2013 8:42 AM
>
>
> Right.
>
> The http://scg.unibe.ch/archive/papers/Berg03aClassboxes.pdf work, 
> which inspired Ruby refinements as well as the scoped object 
> extensions strawman, is about Smalltalk. For all its dynamic typing, 
> Smalltalk has nominal class types and static method membership 
> judgements.
>
> Based on the research, it seems to me that if we want this in JS, we 
> should look at how to build it on ES6 classes + modules.
>
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
> Andreas Rossberg <mailto:rossberg at google.com>
> October 14, 2013 2:13 AM
>
> I wasn't at that meeting, but yes, the V8 team strongly objected to
> this. A scope-dependent, 2-dimensional lookup matrix (even
> 3-dimensional for variables inside 'with') would be an utter nightmare
> in terms of complexity and optimisation (even by JS VM standards).
> Also, the concrete proposal had questionable semantics. Fixing them
> properly would indeed have brought us back full circle to ES4-style
> namespaces, as Waldemar argued convincingly at some point.
>
> My take-away was that scoped extension methods are only bearable in a
> language with a static, nominal class system (like C#), where the
> additional lookup dimension can be resolved at compile time.
>
> /Andreas
>
> Brendan Eich <mailto:brendan at mozilla.com>
> October 13, 2013 10:49 AM
>> Erik Arvidsson <mailto:erik.arvidsson at gmail.com>
>> October 13, 2013 10:32 AM
>> We did proposes this back in 2011
>>
>> http://wiki.ecmascript.org/doku.php?id=strawman:scoped_object_extensions
>>
>> I wasn't at this actual F2F meeting so I don't know many details.
>> Brendan might remember what the blocking issue was?
>
> I wrote why in my reply, cited below:
>
>> Your subject recalls a defunct proposal to add lexically-scoped but 
>> heap-based -- therefore object property-lookup performance hindering 
>> -- extension properties. This proposal died precise because of the 
>> performance problem.
>
> Every property access sprouts a third parameter beyond object and 
> property name, namely a lexical scope token of some kind. All property 
> maps in objects shared in the heap also sprout such a scope token 
> along with property name.
>
> (This is quite reminiscent of ES4 namespaces, which we agreed to 
> reject from any future ECMA-262 in order to forge Harmony in 2008. See 
> https://mail.mozilla.org/pipermail/es-discuss/2008-August/006837.html.)
>
> Implementors objected, including V8 folks (if I recall correctly, 
> Andreas Rossberg). This was at the May 2011 TC39 meeting hosted at the 
> University of California at Santa Cruz.
>
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
> Erik Arvidsson <mailto:erik.arvidsson at gmail.com>
> October 13, 2013 10:32 AM
> We did proposes this back in 2011
>
> http://wiki.ecmascript.org/doku.php?id=strawman:scoped_object_extensions
>
> I wasn't at this actual F2F meeting so I don't know many details.
> Brendan might remember what the blocking issue was?
>
>
>


More information about the es-discuss mailing list