GithubHelp home page GithubHelp logo

Comments (6)

jgravelle-google avatar jgravelle-google commented on June 17, 2024

It was considered, but IIRC the original proposal was to hard-error on mismatching signatures instead of falling back to a slower path. My guess is that that would cause much more hesitancy than a performance cliff.

Are there better solutions?

from interface-types.

annevk avatar annevk commented on June 17, 2024

I'm not sure. It's probably worth pointing this out somewhere and perhaps in time also include a warning in the IDL specification itself to familiarize it among those writing specifications. With the goal that folks take even more care than usual to what gets written down.

from interface-types.

lukewagner avatar lukewagner commented on June 17, 2024

Good point. I think there is a way to address this:

  • There will be a spec predicate "does this imported function 'match' this Web IDL Binding?" that determines whether the fast or through-JS path is taken (it's subtly semantically visible, so testable).
  • This predicate could accept bindings that pass a subset of the imports' parameters when the extra parameters are marked optional (the semantics being to pass the default value).
  • The guidance is thus (if it isn't already, which I bet it is), if you extend a method, make sure the new parameters are marked "optional".

This does require specializing a binding's generated stub to the callee, but I've been assuming that that is generally necessary in my mental model of the implementation, for a variety of reasons.

from interface-types.

littledan avatar littledan commented on June 17, 2024

This outline seems plausible, but this does not sound like a trivial relation to specify (and I imagine the implementation side would be even more complicated). About whether this is expressive enough: seems like this would catch cases like adding an entry to an enum in the browser but not the application code, but not rephrasing checks from spec prose to IDL (e.g., WebAssembly/spec#977). cc @Ms2ger.

from interface-types.

lukewagner avatar lukewagner commented on June 17, 2024

I agree the relation will be complicated, but I think that is just inherent to the design, addressing not just this, but all the other bullets under Question #2 in the explainer that we discussed earlier.

Adding cases to enums or optional fields to dictionaries should independently fall out of the "structural subtyping" aspect of the design (mentioned in the Web IDL Types section of the explainer) of how value types are passed.

from interface-types.

pchickey avatar pchickey commented on June 17, 2024

Closing as out-of-date: the proposal no longer has the same sort of relationship to WebIDL as it did during this discussion. I don't think most of these concerns apply anymore. If I am incorrect, please re-open :)

from interface-types.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.