Le 17/12/2012 15:19, Anne van Kesteren a écrit :
If down the road we want to allow for the theoretical possibility of
having all platform APIs implemented in JavaScript, we might want a
sync Object.observe.
Which part of the platform needs a sync Object.observe?
I feel all platform APIs can be implemented with ES Proxies (WindowProxy being one exception soon solved, I hope). If the objects people wanted to observe were only objects they created, a library on top of proxies would be enough for that. It's the necessity to observe objects that the author doesn't create that makes Object.observe a necessary API (and I'll be honest, it's also convenient to have regardless)

If we have types down the road as well (this
might be a bit presumptuous), URLQuery could just be a MultiMap and
whenever the MultiMap was mutated you'd update the associated URL
synchronously (and potentially do other things, such as navigating to
a URL). The latter would require synchronous change delivery. Or I
suppose some kind of subclass that changes all the manipulation
methods to also perform some kind of notification.
I don't understand what you mean by "types". And I also don't understand what you can't implement in pure ES6 in what you've described.

I feel there are 2 different goals:
* Being able at all to implement browser APIs in ECMAScript (which is close to being possible with Proxies. document.all being an exception). * Being able to conveniently implement browser APIs in ECMAScript (which may require the addition of a MultiMap) which is up for debate.

I guess the problems here are that a) there's no MultiMap b) there's
no types c) we want to reduce the burdon on developers for doing URL
manipulation probably without waiting for a/b, but I rather not pull a
Typed Array.
Similarly, there's an idea to expose the path of a URL as an array of
segments. Ideally this would be a type-constrained Array that when
manipulated updates the associated URL.
I think you can create your own abstractions using proxies. For instance, you can create proxies which accept only one type as property values. I encourage to experiment and build what you need. If you face things that are impossible to build with proxies, come share your experience here. Likewise if you feel the current APIs make your abstractions inefficient by design.

David
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to