rapodaca:

Reread my original post. Even if you turn the mangling off, the name
would then become:

com.mypackage.MyClass::hello()

Instead of what you probably want:

hello


Due to the parens, you'd need to call it like so:

window.["com.mypackage.MyClass::hello()"]();

instead of like so:

hello();

'unwieldly' doesn't really cover the ridiculousness of working with
this. 'utterly ridiculous' is a bit closer to the mark. The above is
WITHOUT the mangling. -style pretty is a bit less unwieldy, but,
really, you'd have to get in there and write your own identifier
formatter that does saner things, and that's just one thing that comes
to mind. I'm fairly sure its not going to be the only hurdle.


On Jan 8, 1:26 am, rapodaca <rich.apod...@gmail.com> wrote:
> On Jan 7, 12:20 am, ReinierZwitserloot<reini...@gmail.com> wrote:
>
> > What you want can't really be done. Java isn't javascript. Take your
> > example just to illustrate the problem here: How would that even
> > translate to javascript? Javascript doesn't have classes. It has
> > prototype based inheritance. Here are your fundamental problems:
>
> Reinier, thanks for the info. Actually, a class isn't the thing I'm
> after. What I really want to create are objects. So I thought it could
> translate something like this:
>
> <html>
> ...
> <script src="hello.js"></script>
> ...
> <script type="text/javascript">
> var hello = new Hello();
>
> hello.talk // returns "hello"
> </script>
> ...
> </html>
>
> What am I missing?
>
> >  1. Javascript's namespacing and object model is so different, that
> > GWT internally generates completely different and unwieldy names for
> > objects and classes. These names are then mangled to unrecognizable
> > shortcodes to reduce the size of the output JS. So, your public void
> > hello method is either going to be called: "com.mypackage.Hello::talk
> > ()" (yes, including closing parentheses to indicate that this version
> > takes no parameters; unlike javascript, in java two methods with the
> > same name but different parameter lists are completely separate, in
> > javascript you can't do that), or it's going to be called something
> > small and effectively random, so something like 'xYq' or some such.
> > There's no code to pick a sane name for interaction, so nothing there
> > that would even think to generate just a function called "hello".
>
> I thought it was possible to turn off the mangling by setting compiler
> flags. I've also read about JSNI in this context. Wouldn't one or both
> of these help?
>
> >  2. There's a base set of functions that all GWT projects start out
> > with. The GWT compiler assumes this basis is there.
>
> That wouldn't be a problem for me.
>
> >  3. GWT does something called platform targeting. That's why it
> > generates a number of JS files - one for each target platform. Out of
> > the box, there are already multiple platforms (1 for each major
> > supported browser, so there's an Opera, an IE, a Gecko, and a Webkit).
> > I'm not entirely sure but I believe the base, talked about in #2, is
> > already written specifically for each target browser platform.
>
> Also not a problem.
>
> > If you are in the market to build such a tool, The GWT sources are a
> > great place to start, but unless you're willing to dig in for a few
> > weeks and do a lot of dev work, I don't think GWT can do what you
> > want.
>
> Sounds way above my head. I have to say, though - I'm very surprised
> this hasn't been done already. It seems like such an obvious use of
> GWT.
>
> > NB: I'm not an expert on the GWT internals so I might have made a few
> > mistakes, but I'm fairly sure the above is true. #1 is certainly true,
> > and already a big deal for you.
>
> > On Jan 7, 7:20 am, rapodaca <rich.apod...@gmail.com> wrote:
>
> > > On Jan 6, 5:58 pm, Ziyod <ziyod2...@gmail.com> wrote:
>
> > > > Use GWTCompiler it's part of the com.google.gwt.dev.GWTCompiler
> > > > package
> > > > Create a gwtCompiler.cmd file and insert this command:
> > > > @java -cp "%~dp0\gwt-user.jar;%~dp0\gwt-dev-windows.jar"
> > > > com.google.gwt.dev.GWTCompiler %*
>
> > > Hello Ziyod,
>
> > > Thanks for the information. I'm on Linux, but my best guess for
> > > translation is (creating file GWT_INSTALL/gwtCompiler):
>
> > > java -cp $HOMEDIR/gwt-user.jar:$HOMEDIR/gwt-dev-linux.jar
> > > com.google.gwt.dev.GWTCompiler "$@";
>
> > > This is based on the projectCreator script provided in the
> > > installation.
>
> > > I notice that HOMEDIR is not set so I go:
>
> > > $ export HOMEDIR=~/tmp/gwt-linux-1.5.3
>
> > > Then I try:
>
> > > $ ./gwtCompiler com.example.Test
> > > Loading module 'com.example.Test'
> > >    [ERROR] Unable to find 'com/example/Test.gwt.xml' on your
> > > classpath; could be a typo, or maybe you forgot to include a classpath
> > > entry for source?
> > > [ERROR] Build failed
>
> > > I'm not sure what happened or what the com/example/Test.gwt.xml file
> > > refers to. Any ideas of how to generate it and where to save it?
>
> > > > Find out more:http://www.screaming-penguin.com/GWTDocs
>
> > > That's a good command summary, but unfortunately, I don't see any
> > > example usage.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to