Honestly, I think JSNI should be fully removed from GWT, even GWT.jsni(). 
JsInterop seems to cover all the JS binding cases, I can't see where JSNI 
is still useful. JSNI is a dirty hack, it doesn't supports refactoring nor 
typesafe and it's not really Java. In the other hand, a thing like 
GWT.debugger() is ugly. It could be useful in JS development, but it 
doesn't differs so much from Window.alert("Hi bro, I'm debugging the line 
123"). We already have a debugger, who needs a debugger statement? GWT.* 
methods are usually intrusive and source of code coupling.
That said, I see the need of method rebinding only at JavaToSimplerJava 
level. JavaToJavaScript should be orthogonal, and fully covered by 
JsInterop.

Of course, I'm really interested in enhance code generation.  :-)

- Andrés Testi


El lunes, 16 de diciembre de 2013 17:51:15 UTC-3, Goktug Gokdogan escribió:
>
>
>
>
> On Mon, Dec 16, 2013 at 12:14 PM, Andrés Testi 
> <[email protected]<javascript:>
> > wrote:
>
>> Well, there is a sample for String.format() in the prototype: 
>> https://github.com/andrestesti/gwt-rebindingmethods/blob/master/samples/hellorebinding/src/com/google/gwt/sample/hellorebinding/client/util/Strings.java#L39
>> I agree, method rebinding should eliminate the need of magic methods and 
>> simplify the compiler. GWT.debugger() is a controvesial case because Java 
>> doesn't has a semantically equivalent for it..
>>
>  
> Yes, that is also true for the GWT.jsni case. I think at the end there 
> should be 2 types of rewriters; one for java and one for javascript and 
> they should do real method replacement. Developer can choose either one.
>
> It looks like you are really interested in this. Can you also improve your 
> proposal with real method rewriting?
>  
>
>>
>> - Andrés Testi
>>
>>
>> El lunes, 16 de diciembre de 2013 16:48:52 UTC-3, Goktug Gokdogan 
>> escribió:
>>>
>>> I actually implemented with simple eval for demonstration purposes but 
>>> probably yours is preferable :)
>>>
>>> Yes, GWT.jsni is one of the use cases for method rebinding; that was 
>>> something I was discussing as part of the original discussion.
>>>
>>> In reality GWT.jsni is better to be implementable without "native" 
>>> method definitions so we could eventually take native methods out of the 
>>> compiler.
>>> There are also other use cases like String.format, GWT.debugger and 
>>> GWT.create itself. The ideal solution should cover all to avoid redundant 
>>> features in the SDK.
>>>
>>>
>>> On Mon, Dec 16, 2013 at 10:00 AM, Andrés Testi <[email protected]>wrote:
>>>
>>>> This morning I read the Goktug's slides and was surprised by the 
>>>> GWT.jsni() method. It is a nice use case for rebinding methods. I just 
>>>> added a version of GWT.jsni() to HelloRebinding sample, implementing it as 
>>>> a rebinding method (no compiler mods). It took me just 30 minutes of 
>>>> coding 
>>>> to add an extension to support this:
>>>>
>>>>     JsniUtil.jsni("$wnd.alert(#)", message);
>>>>
>>>> - Usage: https://github.com/andrestesti/gwt-
>>>> rebindingmethods/blob/master/samples/hellorebinding/src/
>>>> com/google/gwt/sample/hellorebinding/client/MainWidget.java#L65
>>>>
>>>> - Definition: https://github.com/andrestesti/gwt-
>>>> rebindingmethods/blob/master/samples/hellorebinding/src/
>>>> com/google/gwt/sample/hellorebinding/client/util/JsniUtil.java#L38
>>>>
>>>> - Generator: https://github.com/andrestesti/gwt-
>>>> rebindingmethods/blob/master/samples/hellorebinding/src/
>>>> com/google/gwt/sample/hellorebinding/rebind/
>>>> JsniSnippetGenerator.java#L32
>>>>
>>>>
>>>> Regards.
>>>>
>>>> - Andrés Testi
>>>>
>>>>
>>>>  -- 
>>>> 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 google-web-toolkit-contributors+unsubscribe@
>>>> googlegroups.com.
>>>> 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]<javascript:>
>> .
>> 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.

Reply via email to