Can Scala be used to write GWT applications?

后端 未结 7 1790
旧时难觅i
旧时难觅i 2020-12-29 04:19

Can Scala be used to write GWT applications?

(NOTE: Java/Scala novice here...)

相关标签:
7条回答
  • 2020-12-29 04:57

    The GWT compiler works with Java source code because that provides the most visibility to allow for optimisations when compiling into Javascript. There has been occasional discussion about working with the bytecode, but the issue always ends up being that a lot of optimisations will be lost if the compiler works with byte code and not source code.

    Nevertheless, there is an interesting thread about supporting Scala. However, the priorities for the GWT team at this point seem to be more focused on the Java language compiler.

    0 讨论(0)
  • 2020-12-29 04:59

    I am aware of two projects that are addressing this issue.

    Jribble(pronounced dribble) is a special form of java that does not have some of the human constraints of java so that it can be used for scala byte and still provide GWT with the information it needs to generate efficient javascript. They mention a github project called scalagwt-sample (http://github.com/rfc2616/scalagwt-sample) that seems quite active.

    Another article I read had a guy using j2js(part of GWT) to cross compile scala to javascript. They won't let me put more than one Hyperlink but here is the url:

    (http://www.j2js.com/scala-demo/scala-days-2010-paper.pdf)

    I have not had time to try either yet but hope to soon.

    0 讨论(0)
  • 2020-12-29 04:59

    Interesting. In that case if I want generated javascript for nice Web 2.0 w/ Ajax I will move to python and pyjamas which was originally a python port of GWT. It also has some other interesting properties like generating code to run as platform independent desktop app. I am not fond of writing POJO much less POJO constrained for conversion to something else.

    0 讨论(0)
  • 2020-12-29 05:04

    If you mean Google App Engine, the service for hosting web applications, the answer is yes.

    If you really mean Google Web Toolkit, the tools for compiling Java into JavaScript to run in the browser, I pretty sure the answer is no. GWT does all kinds of code analysis when compiling to JavaScript and this relies on having Java source files as well as .class files.

    0 讨论(0)
  • 2020-12-29 05:11

    As already said... BUT to be exactly not yet! This project should enable GWT to support client-side Scala code. Also the project is backed up by Google engineers.

    0 讨论(0)
  • 2020-12-29 05:14

    Yes!

    It haves Scala+GWT Project, scalagwt. Quick status (my opinion of course): one step before production usage.

    Detailed status from scala-lang.org

    The Scala to Javascript project is a research project and not yet what we could call a product. You can have fun, but it's not quite at the bet-your-job on it stage yet. There are bugs. We need quite a bit of work on documentation and smoothing the edges.

    Github

    The Scala+GWT project aims to compile Scala code for the browser via the GWT toolchain. You can fork scalagwt project on github here

    Scala + GWT | GoogleDevelopers

    See nice presentation and a lot of explanation on Youtube here

    0 讨论(0)
提交回复
热议问题