Bob's old proposal was to introduce an "Any" type which is the
supertype of all types, including primitives. As a short term fix, you
can do what I did in GWT Exporter and de-box these values. If you are
trying to export JS functions, then you can have a function like:

function debox(val, typeCast) {
 return isScript ? val : typeCast.apply(null, arguments);
}

and then, debox($entry(...), Boolean) will return a 'boolean', and
debox($entry(...), Number) will return a 'number'

-Ray

On Sat, Apr 10, 2010 at 6:24 PM, John Tamplin <[email protected]> wrote:
> On Sat, Apr 10, 2010 at 7:37 PM, Sanjiv Jivan <[email protected]>
> wrote:
>>
>>   private static native Object apply(Object jsFunction, Object thisObj,
>>       Object arguments) /*-{
>>     if (@com.google.gwt.core.client.GWT::isScript()()) {
>>       return jsFunction.apply(thisObj, arguments);
>>     } else {
>>       _ = jsFunction.apply(thisObj, arguments);
>>       if (_ != null) {
>>         // Wrap for hosted mode
>>         _ = Object(_);
>>       }
>>       return _;
>>     }
>>   }-*/;
>> What is the rationale for this wrapping as Object(..) in hosted mode? And
>> can you suggest a workaround for this usecase?
>
> Notice the return type -- you can't return a JS primitive as an Object, but
> a JavaScriptObject can be returned as an Object.
> I have cc'd BobV who wrote this -- perhaps he can suggest a workaround.
> --
> John A. Tamplin
> Software Engineer (GWT), Google
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

To unsubscribe, reply using "remove me" as the subject.

Reply via email to