You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed in whatwg/url#204, there is some confusion about the distinguishability between string types and sequences. Although currently, the spec maintains that they are distinguishable, @domenic and @annevk have express doubts over that.
What I have found is that:
ES string primitives are NOT valid sequences, and are therefore distinguishable. Even though string primitives have a @@iterator, they fail the typeof === 'object' check in conversion to a sequence.
ES string wrapper objects ARE valid sequences. They pass the aforementioned test, and they likewise have a valid iterator interface.
This is exemplified in Firefox, which implements iterable-to-sequence conversion:
>>newHeaders(['ab']).get('a')**"TypeError: Element of member of HeadersOrByteStringSequenceSequenceOrByteStringMozMap can't be converted to a sequence.">>newHeaders([newString('ab')]).get('a')<-"b"
How can we resolve this situation?
The text was updated successfully, but these errors were encountered:
They are very explicitly and purposefully distinguishable, and there are APIs that use (DOMString or sequence<DOMString>). We purposefully allowed that.
ES String objects are in fact valid sequences. They're also valid dictionaries (something else that is distinguishable from strings), valid callback interfaces, etc. The fact is, the current design of IDL was more or less predicated on "people don't use explicit String objects and expect any good to come of it".
I don't think there's anything to resolve here; the spec as written is written as intended and reflects reality.
I think you misunderstood my comment @TimothyGu. I tried to say that they are distinguishable (plus link to prove it), but that I think your proposal is not the way to go.
As discussed in whatwg/url#204, there is some confusion about the distinguishability between string types and sequences. Although currently, the spec maintains that they are distinguishable, @domenic and @annevk have express doubts over that.
What I have found is that:
@@iterator
, they fail thetypeof === 'object'
check in conversion to a sequence.This is exemplified in Firefox, which implements iterable-to-sequence conversion:
How can we resolve this situation?
The text was updated successfully, but these errors were encountered: