W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2015

Re: Web IDL maplike: Allow spec prose to specify how key-type should be compared?

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 9 Mar 2015 12:05:19 -0700
Message-ID: <CA+c2ei_eq_xzSFMfVOiU4imM+S6zzbRimCGmQsR0JGSsOkFisA@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "Mark S. Miller" <erights@google.com>, David Dorwin <ddorwin@google.com>, public-script-coord <public-script-coord@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
On Mon, Mar 9, 2015 at 11:23 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> (This is one more instance of the general problem I've brought up a
> few times, that Map/Set aren't customizable in any way and it's really
> an issue.  There should be an internal "SimpleMap" that just exposes
> the core methods needed, and which can be swapped out by users or
> specs for another object undetectably, so that Map/Set operate as an
> interface contract.)

ES doesn't really have the concept of "interface" which really is what
we're looking for here. It always ties interface and implementation
together into specific classes. Classes which always have a
constructor and which makes sense on their own.

Another example of when this problem shows up is in the design of the
Stream class. The two "ends" of a stream should really be two separate
objects with a specified interface. Those two objects should always
work in concert to make up the stream object. However JS doesn't allow
creation of those two objects without requiring that each object also
can be instantiated and useful on its own.

The closest thing to "interface" that JS has is "duck type".

/ Jonas
Received on Monday, 9 March 2015 19:06:17 UTC

This archive was generated by hypermail 2.3.1 : Monday, 9 March 2015 19:06:17 UTC