domenic / get-originals

A web platform API that allows access to the "original" versions of the global built-in objects' properties and methods
28 stars 1 forks source link

Limitations #22

Open littledan opened 5 years ago

littledan commented 5 years ago

I really like the limitations section of this proposal. I'd suggest that some of these should be part of the get-originals MVP. Some useful cases that you'd get that way:

domenic commented 5 years ago

I think we have very different definitions of "MVP" :).

Overall, I think we should wait for concrete customers to ask for expanded capabilities, which they can't accomplish otherwise, before expanding. Your points are more theoretical, but I'll respond regardless:

Symbol-named methods + not-on-the-global classes

You can use forEach to iterate over Maps and Sets. Not sure about FinalizationGroups, but I'd expect them to follow the same pattern.

Defined-in-JavaScript global functions: eval is pretty core, and different from the Function constructor

We're hoping to not spread the use of eval. I'm also unsure how different indirect eval is from the Function constructor in practice, i.e. in ways that developers rely on.

Built-in module originals: with the Temporal proposal, gives an API to accessing the timezone database (without the inefficient, brittle hack of parsing the result of Intl.DateTimeFormat)

I think this is a very reasonable thing for the champions of individual built-in module proposals to explore and work with us on. The section at https://github.com/domenic/get-originals#built-in-module-originals is meant to constrict the initial focus (what some might call "MVP"), but if someone wants to put in the work, driven by a concrete customer demand for an original timezone database-getting function, we'd be happy to work with them.

littledan commented 5 years ago

if someone wants to put in the work, driven by a concrete customer demand for an original timezone database-getting function, we'd be happy to work with them.

We know that lots of code wants to access the tzdb, e.g., any datetime library, to reduce binary size. What are you looking for in terms of evidence that integrity is needed? I don't understand how this differs from other cases in the explainer.

You can use forEach to iterate over Maps and Sets. Not sure about FinalizationGroups, but I'd expect them to follow the same pattern.

WeakRefs are being standardized partly to support WebAssembly, but we also know that people write tooling to generate lots of glue code and depend on current JS built-ins, so I am not sure how exactly you would suggest gauging developer demand.

This is a great time to make this suggestion to the WeakRef proposal, given that it's at Stage 2. I don't understand where you'd put the forEach method (since there is no iterable, just the group and the iterator); maybe you could explain in an issue. Here's where you can learn how FinalizationGroups are proposed to work (slightly outdated render): https://weakrefs.netlify.com/#sec-finalization-group-objects

I think this is a very reasonable thing for the champions of individual built-in module proposals to explore and work with us on.

That's why I am filing this issue :) I think your blurb in "limitations" provides a good sketch at a similar granularity to the other parts of the readme; is there something more that you would expect at this stage to help? I could nit-pick on details (e.g., maybe it should be "std:originals/foo" instead of "std:foo/originals"), but I wanted to figure out this scope point first.

littledan commented 5 years ago

I'm wondering if APIs in the future with important capabilities should be designed to be "get-originals-able". For example, should capabilities stay out of built-in modules? Should %FinalizationGroupCleanupIterator% be a property of the global object (even though it won't be very meaningful in that mode, and TC39 was hoping to expose these constructors just through built-in modules)? Or are these things that we would be up for adding to get-originals once there's an API that demands it?