Re: [whatwg/webidl] Language-independent definition of interfaces should mention how to create instances (Issue #1327)

Right, a long time ago there was an attempt to let people use WebIDL to target more languages than just ECMAScript, but we've given up on that, and the primary remaining vestige is the division in the spec between [2 Interface definition language](https://webidl.spec.whatwg.org/#idl) and [3 ECMAScript binding](https://webidl.spec.whatwg.org/#ecmascript-binding). It would be reasonable nowadays to merge those two sections, and doing so would probably help this issue.

But there's actually a subset of WebIDL that *is* language-independent (that is, could be used to target a non-ES environment), in that it's now fully defined in terms of Infra types rather than ECMAScript objects. Dictionaries, strings, numbers, sequences, unions, etc. fall into that subset, while interfaces, Promises, etc. don't.  In Web specifications, I think the effect is that you can create instances of the language-independent types from 'in parallel' or generally in contexts that don't have a 'current realm', while you can only pass around references to existing language-dependent objects in those contexts.

I guess my actual point in this issue is that it should be clearer to spec authors which types fall into which subset, to make it easier to keep our cross-realm references straight. Interfaces seem to be the easiest to get confused about, but we should also be clearer about the other types.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1327#issuecomment-1601949975
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1327/1601949975@github.com>

Received on Thursday, 22 June 2023 03:01:42 UTC