w3ctag / design-principles

A small-but-growing set of design principles collected by the TAG while reviewing specifications
https://w3ctag.github.io/design-principles
177 stars 46 forks source link

Provide some guidance on creating new list types #133

Open marcoscaceres opened 5 years ago

marcoscaceres commented 5 years ago

I noticed that the Web Speech API is defining new *List and list-like types:

They are "array/list-like" in that they have a .length, an index accessor, and so on, but are actually incompatible with the ES iterator protocol (and violate the "give things constructors principle").

We should probably provide guidance against defining new list types for the platform, and instead rely on WebIDL iterable (or setlike, tho that's rare I believe).

annevk commented 5 years ago

Is this perhaps because it's an old API in a way? I think for new stuff we generally encourage sequence<T>.

marcoscaceres commented 5 years ago

Sure, it’s more to catch APIs developed in isolation (in the off chance they also land at this guide). We can’t keep an eye on everything, unfortunately.

hober commented 4 years ago

See also WICG/construct-stylesheets#45

hober commented 4 years ago

See also #50.