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

[Bug 27008] "Initializing objects from iterables" needs syntax

From: <bugzilla@jessica.w3.org>
Date: Mon, 30 Nov 2015 10:20:45 +0000
To: public-script-coord@w3.org
Message-ID: <bug-27008-3890-SHXzCMETSn@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27008

--- Comment #11 from Cameron McCormack <cam@mcc.id.au> ---
I think as Boris says, given you want to pass the object down to either the
"initialize map from an iterable" or "initialize map from an open-ended
dictionary" prose algorithms, you don't gain anything from having syntax for
MapInitIterable and OpenEndedDictionary.  And given you can treat a Headers
object like the from-iterable case, I think using `optional object` and passing
the object off to a single prose algorithm that handles both initialization
types would be the most straightforward thing to do.  Call that algorithm "add
map elements from an object" and have it do:

* If object has an `@@iterator`, then call "add map elements from iterable".
* Otherwise, call "add map elements from open-ended dictionary".

which is pretty much what the JS-to-union-value conversion algorithm would do
when deciding whether we've got a MapInitIterable or OpenEndedDictionary.

If we need an API later where we do need to handle other IDL interface types
differently (e.g. say if Headers weren't iterable), then we could make object
be distinguishable from interface types.  But for now I don't think it's
necessary.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Monday, 30 November 2015 10:20:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:24 UTC