Comments (5)
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 and 3 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.
from webidl.
Is Web IDL meant to be “language-independent” in that sense? It supports multiple language bindings, but as far as I can tell, one of them must always be an ES binding. A lot of important parts of the spec (e.g. calculation of member exposure sets, types like Promise<T>
) appear to intimately depend on the existence of an ES environment and the semantics it brings to the party, sometimes in ways that appear to have security/integrity implications.
from webidl.
I don't think it's a supported use case to create objects in a language-independent environment. There's an abstraction layer to allow multiple language bindings (in theory), but using Web IDL in an environment without a target language isn't supported or desired. (And indeed, even using it in a non-JS environment isn't really supported, although in theory it might be desired.)
The second paragraph of https://webidl.spec.whatwg.org/#introduction tries to make this clear, I think.
from webidl.
I like that framing, and especially the focus on in-parallel vs. in-a-realm contexts. Agreed.
from webidl.
I'm not sure fully merging the language with the binding would be desirable given the existence of Wasm and the knowledge that implementations typically have a C++/Rust binding. Otherwise agreed.
from webidl.
Related Issues (20)
- Meta: npm warnings HOT 1
- Definition name uniqueness requirement omits mixins
- Suggestion: forbid ECMA-262/402-defined global names for some named constructs HOT 2
- Nullable ObservableArray attributes are not supported HOT 1
- Make ObservableArray "subclassable" HOT 3
- Definition of {} is slightly ambiguous HOT 2
- Named properties object [[GetOwnProperty]] conflicts with class string HOT 1
- Add `toggle()` and `replace()` methods to `setlike` HOT 1
- Allowing throwing an exception with a specific message HOT 5
- Offer [[ArrayBufferDetachKey]] abstraction?
- Truncation in "convert a Web IDL arguments list to an ECMAScript arguments list" seems (potentially) incorrect
- Dictionary with required members as optional argument HOT 4
- "byte length of a buffer source type" needs updating for resizable and detached buffers HOT 9
- Intent to use BigInt/numeric union in WebNN HOT 6
- CreateMethodProperty removed from Ecma262 HOT 1
- Disallow FrozenArray<> in argument lists, and maybe dictionaries and return types HOT 4
- Declaration of dictionaries with dynamic keys identified by type, but not by name HOT 6
- Should [SameObject] be allowed with FrozenArray<T>? HOT 5
- Declaration of dictionaries with dynamic keys identified by type, but not by name HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webidl.