Le 13/05/2011 14:28, Rick Waldron a écrit :
David,
This is awesome, thank you for taking the time to put this together.
No problem. I think it's important to prove that things work by doing
them. And this attitude seems to be widely shared on this list which is
a good thing.
If I have any specific questions for you, should I ask them here
(perhaps others would benefit) or should I email you directly?
I'm fine with both. I think that any question related to ECMAScript may
benefit to the list. Depending on your question, other people may
respond in my place if they feel they know the answer or start a debate
if they disagree with my answers. I think a debate is good when it's
transparent and constructive.
However if don't feel comfortable writing on the list, there is no
problem to ask me your questions directly.
David
Thanks again
Rick
-- Sent from my Palm Pre
------------------------------------------------------------------------
On May 13, 2011 5:09 AM, David Bruant <[email protected]> wrote:
Le 13/05/2011 02:55, Rick Waldron a écrit :
> David,
>
> For clarification, can you give a working example (ie runable in FF
> nightly) of this:
>
> "Object.prototype.toString could return different
> things for DOM objects. This can certainly be implemented in pure
> ES.next with WeakMaps. "
Sure. Here is an example of what I was thinking:
https://gist.github.com/970223
I run it directly on the webconsole and it works like a charm (Tested on
latest FF nightly on Windows 7 64bits)
A couple of things to keep in mind:
- I have no idea which DOM "classes" people expect and what particular
values of [[Class]] are set for them.
- I do not create objects respecting the DOM interfaces (it shouldn't
make any difference, but tell me if you think it does)
- My sole purpose was to prove feasbility. I am aware that the solution
I show is suboptimal in several ways (especially the several
redefinitions of Object.prototype.toString)
- The same could have been achieved with arrays instead of weak maps,
but would have led to memory leaks.
- I assume the "environment setting" code to run in a fresh conforming
ES environment (ES5.1 + current implicit consensus on WeakMaps)
David
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss