[gwt-contrib] GWT,jsni() implemented as rebinding method

2013-12-16 Thread Andrés Testi
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [gwt-contrib] GWT,jsni() implemented as rebinding method

2013-12-16 Thread Goktug Gokdogan
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 andres.a.te...@gmail.comwrote:

 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+unsubscr...@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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [gwt-contrib] GWT,jsni() implemented as rebinding method

2013-12-16 Thread Goktug Gokdogan
On Mon, Dec 16, 2013 at 12:14 PM, Andrés Testi andres.a.te...@gmail.comwrote:

 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 andres@gmail.comwrote:

 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+unsubscr...@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 google-web-toolkit-contributors+unsubscr...@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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.