On Tue, Apr 7, 2009 at 4:08 PM, Ian Bambury <[email protected]> wrote:
> 2009/4/7 Vitali Lovich <[email protected]> > >> >> >> On Tue, Apr 7, 2009 at 2:38 PM, Ian Bambury <[email protected]> wrote: >> >>> GWT isn't Java. It just uses Java syntax so that Java books are useful, >>> and things like Eclipse work for it. >> >> I believe the main goal was that you could do a lot of optimization at >> compile-time that just aren't possible at runtime (i.e. browser checks for >> compatability disappear) & the generated code can be smaller. >> > > Maybe, but that could be done using the syntax of any language. I doesn't > explain why Java syntax was chosen. > Well there's a lot of development experience & tools surrounding Java yes. But I have a feeling that it has also to do with the compiling Java into Javascript not introducing significant limitations on the language syntax that can be used & not changing the expected semantics of your Java code. Yes, you could do the same thing with C++ - but you'd find that writing the compiler is very difficult and you've all of a sudden gotten harder development because most C++ constructs cannot be used (pointers, pass by ref for example, any kind of memory deallocation, non-new memory allocation) which means that your developers are going to be using a heavily restricted version of C++ anyways. Also, debugging that C++ in an equivalent hosted mode would be slightly more difficult to implement in that a C++ garbage compiler would be needed. Whereas with Java, there's already a VM to run your code in debug mode for you. The syntax maps naturally & the only restriction was on the full use of reflections. Then there's also that, from what I've heard, Java is a pretty popular language for development at Google (maybe C++ for some of the core search stuff & maybe Python for scripting). So it might also have been a business decision. > > >> >> >>> GWT code becomes JavaScript. It is never at any point Java. >>> >> Well, technically, in HostedMode, it is Java with some minor Javascript >> code acting as a communication interface. >> > > Nowhere is there a GWT-Java-JavaScript chain > When you run in hosted mode it goes as follows: Browser loads page -> executes some javascript which connects to the VM -> executes your onModuleLoad Any code you have that access browser stuff (i.e. DOM, events, etc) then at some point sends that stuff to the javascript stub which performs the actual execution (I believe that's how it goes - although I'm not 100% sure on the Java->javascript path). The javascript->java path is always the way your Java code executes in hosted mode. > > If you compile GWT code it does *not* become Java at any point. > Correct. But in HostedMode your code isn't compiled by the GWT compiler, but rather the Java compiler. > > Hosted mode is not an intermediate stage on the way to JavaScript: it is a > useful dead-end. > Correct. > > >> Threading is possible (or rather will be). Gears & HTML5 browsers >> introduce the concept of worker threads. >> > > Is threading possible right now? No. I wasn't trying to make statements > that a US lawyer would think were bomb-proof, I was just generalising things > for the present moment (not any time in the future) and assuming that we > were talking about GWT. Gears is not GWT any more than Java applets or Flash > are. > But it is possible. Use Safari 4 or FF3.5. Or install gears into your browser. It's not part of GWT, but it definitely is possible using native Javascript (which was your original statement - that threading is impossible in javascript right now). As for Gears, it's not part of GWT, but it's what major parts of HTML5 were based off of, so you can think of it as HTML5-like support for non-HTML5 browsers. It is accessed in the browser via javascript (and at some point jumps out of the browser into a native dll for the functionality that is not available as part of the browser). > >> It would be an impossible task to emulate every possible class in every >>> Java library in existence. And would take for ever. >>> >> Not to mention that some are simply not possible due to browser >> restrictions (i.e. most of the java.io. stuff). >> > > > I would have thought that "...and some are impossible..." had that > covered. No? > Yup... just wanted to clarify why :D. Not that it's too large a task, rather that it is not possible because that behaviour is not permitted by the browser's javascript sandbox. > > Ian > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
