public interface Bax{ public String getValue(); } public class Bar implements Bax{ String size; public String getValue(){return size;} }
public class Foo implements Ba... OH WAIT!! You have one class returning String, and another returning int. I was going to say you need to use interfaces more, and the compiler WILL generate singleton functions and add them to prototypes as needed, but you have different data types. Just because it's the same in javascript to return x.a, does NOT make it the same in Java, and like it or not, the strength of GWT is that it is hierarchial, object-oriented javascript. You CAN'T inline these functions, because when you just call getSize() or getName(), it will just return the variable, but it you add more functions to Bar like public int OR(Bar a){ return a.size()|this.size(); } The compliler can generate function xYz(b){ return this$static.a | b.a;} This is NOT legal for Strings anywhere, and any prototypes inline to take advantage of compiler naming conventions would result in HUGE permutation chains to determine what areas of javascript can be melted into single functions, but this is not a worthwhile price to pay for file sizes today... ...Cos in the world of tomorrow, next gen browsers like Firefox and Chrome actual use class-based internal optimizations to make your typeless javascript take advantage of the strongly-typed applications by relaxing how they treat data. In old JS, any data could be any other data, and the browser's got to perform type-checking for every + operation, for every new and every x.apply(y);... In new JS, when your app uses a certain expando for numbers-only, or string-only or jsObjects only, it will adapt and stop running redundant checks when data will never be anything but an int... Trust me, an old JS library I wrote in FF2 would run slow for a while, but after a few page reloads, my animations actually speeded up, and benchmarks reported slight but noticeable improvements around 15% after the first run... -- "He whose desires are drawn toward knowledge in every form will be absorbed in the pleasures of the soul, and will hardly feel bodily pleasure --I mean, if he be a true philosopher and not a sham one." - Plato "Wise Words Woven With Will Wakes Worlds" - Alyxandor Artistocles --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---