For what it's worth, I took a quick look at Google's internal code base, and I didn't see any JSOs that would be broken by adding a hasOwnProperty method.
On Wed, Jul 31, 2013 at 3:22 PM, Patrick Tucker <[email protected]> wrote: > Seems like a bad plan to not want to make improvements like this to GWT > for fear of breaking people's code. At most the people who > already implemented it, if any?, have to delete their copy of > the function. Deleting the function seems like a trivial low impact > modification that find and replace would be capable of doing. > > I understand that it should be final, but the function that I pasted above > compiles and runs as expected when added to the version of JavaScriptObject > that I copied into my project to test against? > > Thanks, > Pat > > On Wednesday, July 31, 2013 11:33:39 AM UTC-4, John A. Tamplin wrote: > >> On Wed, Jul 31, 2013 at 11:03 AM, Patrick Tucker <[email protected]>wrote: >> >>> I there any particular reason hasOwnProperty is not in JavaScriptObject? >>> >> >> There are a lot of things that would have made sense to put in JSO >> originally (or likewise on Js*), but adding it after the fact breaks anyone >> who added a method of that name, as they have to be final. >> >> The best we could do is put a static method that you pass in a JSO and >> the key. >> >> It is used throughout GWT and from what I have seen the following would >>> be the best implementation: >>> >>> public native boolean hasOwnProperty(String key) /*-{ >>> // In Firefox, jsObject.hasOwnProperty(key) requires a primitive >>> string >>> key = String(key); >>> return (this.hasOwnProperty(key)) ? true : false; >>> }-*/; >>> >>> Some of the calls, in GWT, cast the key to a string and some >>> don't. Seems like a standard implementation that is used would be a better >>> plan. >>> >> >> I agree a shared implementation rather than multiple copies would be an >> improvement. >> >> -- >> John A. Tamplin >> > -- > http://groups.google.com/group/Google-Web-Toolkit-Contributors > --- > You received this message because you are subscribed to the Google Groups > "GWT Contributors" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
