Monday, July 1, 2013

Re: Is there a way to create "cross-platform scripting" in GWT?


Why does your code need to run on the JVM?

If I was in your position, I would look for a Gwt-only solution. It definitely supports your use case,  look at JSNI and the ScriptInjector.

https://www.google.com/url?q=https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI&sa=U&ei=COLRUZbQA4mFtAbvioHQBg&ved=0CAgQFjAA&usg=AFQjCNGfT9UPdKfETb1mMCigT1bLnSruHg

https://www.google.com/url?q=http://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/ScriptInjector.html&sa=U&ei=2-LRUabPC8XRtAbZwID4Cg&ved=0CAcQFjAA&usg=AFQjCNFUtlqJqyMonzcQM6PMrxIoWl2SsQ

Nonetheless, overall I would advise to use such techniques as little as possible. They make large and complex code bases unstable and hardly testable. They are meant to provide an interface to existing javascript. If your code base is not going to be large and complex, why are you using gwit ;-)

- Oliver

On Jun 26, 2013 2:16 PM, "Sebastien Diot" <skunkiferous@googlemail.com> wrote:
Hi.

I would like to make a "web game" with GWT, and have some of the code "scripted" rather then compiled, to allow dynamic updates/tweaking without rebuilding and re-deploying.

Now the hard part is, what scripting language could I use to execute the scripts that would both run within the JVM and in JavaScript on the browser?

While "JavaScript" would seem like an obvious answer, I fear it would not do, due to the fact that is doesn't support "longs" natively (which I use a lot as IDs ...). Maybe there is an easy work-around, I haven't actually dived into GWT, yet so I would not know about it. I do know that GWT can compile Java code to work correctly as JavaScript even with long, but I don't know if the same solution can be used within hand-made scripts.

Regards,
Sebastien

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment