Can you be more specific? What is the efficiency issue? (Low-
priority question asked out of curiosity, disregard if too busy.)
Cheers!
Rob
Also, with the new HashMap implementation, it's not clear whether we even want FastStringMap anymore, in fact I was planning to switch HTMLTable back to using HashMap in the near future.
-1 (non-binding)
Because this approach to solving 631 is not as future-proof as using
hasOwnProperty or a prefix method I think this is a poor addition to
GWT.
New JavaScript engine updates could break exsting GWT apps because the
"killWords" can get out of date. Mozilla has announced that they will
be reworking their JavaScript engine to take advantage of the
JavaScript JIT donated by Adobe. Who knows what internal details will
change with that. Also, as browsers support new versions of ECMAScript
the list of needed killWords may change.
I don't want to potentially revisit and rebuild old GWT apps to try to
diagnose very obscure bugs every few years. Every employer out there
is going to feel the same way.
--
Sandy McArthur
"He who dares not offend cannot be honest."
- Thomas Paine
-1 (non-binding)
Because this approach to solving 631 is not as future-proof as using
hasOwnProperty or a prefix method I think this is a poor addition to
GWT.
New JavaScript engine updates could break exsting GWT apps because the
"killWords" can get out of date. Mozilla has announced that they will
be reworking their JavaScript engine to take advantage of the
JavaScript JIT donated by Adobe. Who knows what internal details will
change with that. Also, as browsers support new versions of ECMAScript
the list of needed killWords may change.
I don't want to potentially revisit and rebuild old GWT apps to try to
diagnose very obscure bugs every few years. Every employer out there
is going to feel the same way.
Yes, I was definitely NOT planning to close issue #631. I do think
it's a useful enough partial to merit fixing some of the immediate
problems.
> The main thing that concerns me about the kill-words approach is not so much
> the future proofing issue, but the implementation specific property issue.
> The list of standard properties varies across browser as some
> implementations have used non-standard properties to expose implementation
> specifics. For instance, your list is missing '__proto__' which is a FF only
> property holding an instance's prototype chain.
We should definitely make to be as thorough as possible, consulting
browser doc, etc. Where did you find the doc for __proto__? I was
looking here (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.5/reference/object.html)
which doesn't list it.
Scott
Should a potentially band-aid solution expose a new public method?
> > The main thing that concerns me about the kill-words approach is not so much
> > the future proofing issue, but the implementation specific property issue.
> > The list of standard properties varies across browser as some
> > implementations have used non-standard properties to expose implementation
> > specifics. For instance, your list is missing '__proto__' which is a FF only
> > property holding an instance's prototype chain.
>
> We should definitely make to be as thorough as possible, consulting
> browser doc, etc. Where did you find the doc for __proto__? I was
> looking here (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.5/reference/object.html)
> which doesn't list it.
When I add "__proto__" to the kw array from your foo.html tester I get
the alert "__proto__ is defined!" in Firefox. And the "done" alert
never shows because of a script error in the "// make sure the
assignment stuck" tests.
http://groups.google.com/group/Google-Web-Toolkit-Contributors/msg/eb3e5cee315a4e25
Unfortunately in my tests hasOwnProperty("__proto__") always returns
true for me in Firefox. This makes the prefix method the only reliable
method which only works for the Map use cases. The places where a user
provided JSO is used (Dictionary, JSON) you have to use hasOwnProperty
plus a special case check for "__proto__" in gecko browsers to be
correct.
Should a potentially band-aid solution expose a new public method?
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Property_Inheritance_Revisited:Determining_Instance_Relationships
When I add "__proto__" to the kw array from your foo.html tester I get
the alert "__proto__ is defined!" in Firefox. And the "done" alert
never shows because of a script error in the "// make sure the
assignment stuck" tests.
http://groups.google.com/group/Google-Web-Toolkit-Contributors/msg/eb3e5cee315a4e25
Unfortunately in my tests hasOwnProperty("__proto__") always returns
true for me in Firefox. This makes the prefix method the only reliable
method which only works for the Map use cases. The places where a user
provided JSO is used (Dictionary, JSON) you have to use hasOwnProperty
plus a special case check for "__proto__" in gecko browsers to be
correct.
On 3/23/07, Sandy McArthur <sand...@gmail.com> wrote:Should a potentially band-aid solution expose a new public method?
If the method is itself inherently useful, I think the answer is yes. I do think it's inherently useful, personally.
Unfortunately in my tests hasOwnProperty("__proto__") always returns
true for me in Firefox. This makes the prefix method the only reliable
method which only works for the Map use cases. The places where a user
provided JSO is used (Dictionary, JSON) you have to use hasOwnProperty
plus a special case check for "__proto__" in gecko browsers to be
correct.
Rats, that is indeed unfortunate. If that's the only case, though, I'm not sure I would consider it a dealbreaker. Thoughts?
Google Web Toolkit (GWT) is an open source Java software development framework that makes writing AJAX applications like Google Maps and Gmail easy for developers who don't speak browser quirks as a second language . Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatibilities between web browsers and platforms, and JavaScript's lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile.
GWT lets you avoid many of these headaches while offering your users the same dynamic, standards-compliant experience. You write your front end in the Java programming language, and the GWT compiler converts your Java classes to browser-compliant JavaScript and HTML.
The case where the user provides the JSO to JSON seems ambiguous to me... are we going for a true reflection of their object (and all its warts), or some kind of scrubbed view of it?
Sandy is making a number of persuasive points. I think we should reconsider createEmptyObject() unless we can identify some sort of once-and-for-all solution that addresses all of the concerns (which, unfortunately, doesn't appear to be possible).
Kelly wrote this micro-benchmark a while back:
http://web.kellegous.com/scratch/2007/01-hash-bm/
I've made a table comparing the four browsers:
http://spreadsheets.google.com/pub?key=pDH5-1uJePizcHBcYRipLIw
Generally speaking using a prefix is 3.8% slower than trying to use a
clean object when it comes to raw inserts and reads. I suspect the
worst case would be iterating over a Map's keys because you'd have to
strip the ':' prefix every time.
Still, that ~4% is in the context of a micro-benchmark. In the context
of a whole app, how much time is really spent inside the Map classes?
I can't really answer that in web mode without a profiling tool but in
the Java app I'm working on right now my profiler rounds it to 0% of
total cpu time. 4% of at most 0.4999% isn't much. Try the more robust
approach first, and if the groups catch on fire from Maps being
intolerably slow then try something else.
That sounds like something Knuth might say in reference to
optimization and evil.... I like it.
Ian
--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
Still, that ~4% is in the context of a micro-benchmark. In the context
of a whole app, how much time is really spent inside the Map classes?
I can't really answer that in web mode without a profiling tool but in
the Java app I'm working on right now my profiler rounds it to 0% of
total cpu time. 4% of at most 0.4999% isn't much. Try the more robust
approach first, and if the groups catch on fire from Maps being
intolerably slow then try something else.