ECMAScript Object equivalence classes proposal

David Bruant david.bruant at labri.fr
Sat Apr 2 16:19:24 PDT 2011


Le 02/04/2011 23:40, Brendan Eich a écrit :
> On Apr 2, 2011, at 1:58 PM, David Bruant wrote:
>
>> I'm surprised by the idea that == could be defined on a per-value
>> comparison basis on objects (Array as you give it as an example). It
>> doesn't make the relation last throughout the program lifetime (which is
>> what I was trying to do and requires a priori arrangements). I would
>> expect an equivalence relation to last throughout the program. Like ===
>> does.
>
> The use-cases are "operators", generally. Python supports unstratified
> operator meta-programming, so you can write __-delimited methods to
> change the meaning of programs. This is in the Harmony agenda but not
> for ES.next:
>
> http://wiki.ecmascript.org/doku.php?id=strawman:value_types
> http://wiki.ecmascript.org/doku.php?id=strawman:value_proxies
> Pythons API
> <http://docs.python.org/reference/datamodel.html#emulating-numeric-types>
> Virtual Values for Language Extension
> <http://www.soe.ucsc.edu/research/report?ID=1595>
>
> It needs more baking. The value proxies idea is nearest but stratifed
> and constrained, aimed at efficient implementation of new numeric
> types. The ability to add operators to existing objects is not
> well-explored yet.
> For a non-operator-syntax proposal to add lexically scoped methods as extensions to standard objects, using weakmaps under the hood (but observably in that the extended object could be frozen), see
>
> http://wiki.ecmascript.org/doku.php?id=strawman:scoped_object_extensions
>
> (This page needs to be linked from http://wiki.ecmascript.org/doku.php?id=strawman:strawman still.)
>
> The advantage is that independent modules can cooperate without a prior arrangements or collisions.
I have the feeling that none of these can help out with multiple
inheritance. This is the problem I want to address. Equivalence classes
through == and instanceof tweak were just one idea to address it.

It's not the first time that I try to address multiple inheritance and
that no one really answers on this particular question, so I think I
should ask the question directly instead of proposing ideas on the topic:

Is multiple inheritance a use case that TC39 intends to address in a
generic manner?

If so, what are the current tracks?
If not, I promise, I won't bother on the topic anymore :-)

Regards,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110403/0d9e0f3a/attachment.html>


More information about the es-discuss mailing list