4 ms·
When it comes to JavaScript / Web APIs, the language you're looking for is WebIDL. The standards specify all APIs in WebIDL, and I believe Chrome does exactly w
by kentonv 5y ago
When it comes to JavaScript / Web APIs, the language you're looking for is WebIDL. The standards specify all APIs in WebIDL, and I believe Chrome does exactly what you're describing, generating C++ interfaces from WebIDL.
In Cloudflare Workers we've taken a different path, having the C++ interfaces be the source of truth, as we feel this leads to less cognitive overhead for developers on the project (and avoided the need to write a new WebIDL code generator matching our internal C++ dialect). It's possible we'll revisit this decision in the future, but for the moment it seems to be working well.
- e12e 5y agoLooking at https://webidl.spec.whatwg.org/ https://webidl.spec.whatwg.org/ I'm not sure if I understand how this really helps bridging type information from js to python to c++ - it looks very tied to js? There's openapi (swagger) and json schema which seems more like helping define RPC over http?