3 ms·
Flutter sits half-way between those two. It's more structured than JS with static types (and without all the JS oddities). It's also lighter syntax than Java wi
by hajile 8y ago
Flutter sits half-way between those two. It's more structured than JS with static types (and without all the JS oddities). It's also lighter syntax than Java with type inferencing and real first-class functions (and not everything has to be an object). The syntax is very familiar, so picking up the language is easy (Swift is syntactically quite similar).
Dart doesn't have the library issues like JS or the bloat like Java. In addition, Dart is an ECMA spec (like JS), so there are no copyright issues like with Java (other companies can even get committee members if they really wanted to invest in the language).
Dart was designed to prevent all the dynamic coding techniques that make JS slow (you can write very fast JS, but not in a normal style). Dart should be able to perform about as well as Java (it could beat Java on some benchmarks a few years ago).
https://www.nikolaybotev.com/blog/dart-vs-java-the-deltablue-benchmark/ https://www.nikolaybotev.com/blog/dart-vs-java-the-deltablue...
When you consider Java is multi-threading while the Dart implementations generally are not, performance is quite similar in the benchmark game too
https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/dart-java.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Off-topic, but for the pidigit test, Java just unloads all the work to a C lib. How is that a Java test? Any language will be "fast" if they are actually just leveraging highly-optimized C libs.
- orbifold 8y agoRe: Java / C usage: Generally I think this is a valid approach. Most languages use a C/C++ runtime for core data structures and abstractions. Go and Rust are notable exceptions. Ideally as a developer you are able to extend this core functionality in a seamless way. Python, Lua, JavaScript (the v8 implementation at least) and Java (JNI) are good examples where this is easily possible.
- hajile 8y agoI agree completely for day-to-day use, but the benchmark game is specifically to test implementations. If you're offloading to C, then you're testing the C implementation and the FFI implementation instead of the language implementation. If you want to test those, then come up with a specific test for that.
- igouy 8y ago> … testing the C implementation and the FFI implementation instead of the language implementation… No, not "instead-of" but "as-well-as".
- simplify 8y agoThat all makes sense, but it's disappointing to see that Dart is no better than Java in type safety. Every type is nullable (the billion dollar mistake), and the type system is too weak to support mildly advanced data modeling without requiring heavy OOP. Dart is a pain to work with. But to be honest, Flutter makes it worth putting up with.
- hajile 8y agoNon-nullable types are in the works. I'd love for Standard ML to become popular as it offers all the things in a pragmatic package. The ML languages (and their hindley-milner roots) have sat around for over 45 years without being adopted into the mainstream. At some point you have to admit that the world isn't ready for a great language yet and go with something that is a step in the right direction. If I have to use a lowest-common-denominator language, I'll take Dart over Java any day. The syntax is better, first-class functions with closures are far superior to anything Java offers, decent type inference, etc are all steps closer to SML and make life easier.
- pjmlp 8y agoAre you comparing Dart with Java 8?
- hajile 8y agoEDIT: somehow submitted half-way through typing. Even comparing with Java 8, dart syntax is much better IMO. Java 8 type inference gets better, but still not as good (Java 10 looks to be getting closer). Java 8 type inference gets better, but still not as good (Java 10 looks to be getting closer). Java lambdas are a joke compared to Dart. This stems from functions being first-class in Dart, but being second-class citizens in Java. Dart can handle a much more functional programming approach much more easily than Java. Java closures only work with final variables while dart works with all enclosed variables. In Java, if I want a function to accept another function, I have to explicitly say that I accept a Lambda because Lambdas are special cases. With dart, I can accept any function that matches my expected types because functions are first-class. Another big difference is that Dart functions can be top-level. If I need a one-off function somewhere, I don't need to pack it in a class. I just make it and use it. I also prefer Dart syntax because of things like private variables, implicit setters/getters, named parameters, async/await, no need for `new` keyword everywhere, implicit interfaces, generators, etc.
- igouy 8y ago"Some language implementations have arbitrary precision arithmetic built-in; some provide an arbitrary precision arithmetic library; some use a third-party library (GMP); some provide built-in arbitrary precision arithmetic by wrapping a third-party library." https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/pidigits.html#pidigits https://benchmarksgame-team.pages.debian.net/benchmarksgame/...