Hacker News new | ask | show | jobs
by grimlck 5353 days ago
It actually seems like Dart didn't reuse anything in GWT, other than 'lessons learned' - if it did, it would have the GWT compiler's dead code elimination, optimizations, dev mode, story of your compile, code splitting, etc.

I'm guessing it wouldn't be a good match because Dart is fundamentally closer to a dynamic language than a statically typed language

The similarities to java seem to come from conservatism in language design more than anything else.

1 comments

A way to show differences is to say what steps would be involved getting Dart code to run on the JVM. As far as I can tell the only real difference is type erasure, so all you'd have to do is:

1) erase types. All method parameters become Object, all variables become Object.

2) implicitly add an interface to each class for each method type ie classes with String toString(String) get an implicit interface with one method Object toString(Object).

3) implicitly cast from Object to the method-interface type in order to call methods.

That sounds pretty slow, but also not very far from Java. I doubt it would take more than a day to make a prototype .dart to .java source converter that actually worked on JVM.