Nowadays, the only thing driving Dart seems to be Flutter, which again is head-scratching. Like, "Flutter sounds interesting but in addition to learning Flutter I need to learn a brand new programming language for it that's really only used for Flutter?" People only have so much bandwidth for new things and there's already so much to constantly learn in our industry.
> not that far from Java
This is something that hurt us, I think. You can write Dart code that looks a lot like Java, and many of our early public examples did. To make matters worse, for no good reason, Dart 1.0 didn't do any type inference, so even though you could use "var" for local variables, doing so would give you a worse user experience.
But you don't have to write Java in Dart. You can write really elegant, clean code in Dart in a way that Java doesn't enable. You don't have to stuff everything inside classes. We've always had nice terse lambdas, higher-order functions, collection literals, etc.
Here's a random little program of mine:
import 'package:hauberk/src/engine.dart';
import 'package:hauberk/src/content.dart';
main() {
var content = createContent();
var save = content.createHero("blah");
while (true) {
var watch = Stopwatch();
watch.start();
// Generate a dungeon at each level.
var count = 0;
for (var i = 1; i <= Option.maxDepth; i++) {
var game = Game(content, save, 1);
for (var _ in game.generate());
// Read some bit of game data so the JIT doesn't optimize the whole
// program away as dead code.
if (game.hero.pos.x >= -1) count++;
}
watch.stop();
print("Generated $count dungeons in ${watch.elapsedMilliseconds}ms");
}
}
It's not the most beautiful code in the world, but I do think it's a good bit simpler and cleaner than it would be in Java.It's also something you could do in Java, with the exception of having to wrap main with the obligatory EntryPoint class.
I think this just goes to show that good code can be written in almost any language (except Perl of course) because writing good code almost always just means writing obvious code, which necessitates avoiding cleverness and obscure features (literally all of Scala), twisting control flow (I'm looking at you State monads and call/cc), or adding too many indirections due to limitations of the language (Java).
Well you do get static type checking if you write it in Dart, but I see your point. :)
It wasn't so much Go per se, but the fact that Google was pushing two new languages at the same time. It created the perception, for me at least, that Google was pushing out new languages to see which ones stuck and kill those that didn't. Google had/has the reputation for killing off projects that it lost interest in. And I wasn't willing to learn new a new language and its ecosystem only to be marooned there a few years later.
So, while I was definitely interested in alternatives to JS, there was no way I'd pick up on Dart.
import engine.*;
import static content;
import static java.lang.System.out;
public class Demo {
public void main(String args[]) {
var content = createContent();
var save = content.createHero("blah");
while (true) {
var start = System.currentTimeMillis();
// Generate a dungeon at each level.
var count = 0;
for (var i = 1; i <= Option.MAX_DEPTH; i++) {
var game = new Game(content, save, 1);
for (var ignored : game.generate());
// Read some bit of game data so the JIT doesn't optimize the whole
// program away as dead code.
if (game.hero.pos.x >= -1) count++;
}
var stop = System.currentTimeMillis();
var elapsedMilliseconds = start - stop;
out.printf("Generated %d dungeons in %dms\n", count, elapsedMilliseconds);
}
}
}Is it really? My Java is rusty, but now that Java has type inference it looks nearly exactly like what you'd type in Java (minus `public static void`, `new`, etc.)
import 'package:hauberk/src/engine.dart'
import 'package:hauberk/src/content.dart'
content = createContent()
save = content.createHero("blah")
while (true)
watch = Stopwatch()
watch.start()
# Generate a dungeon at each level.
count = 0
for (i = 1; i <= Option.maxDepth; i++)
game = Game(content, save, 1)
for (_ in game.generate())
# Read some bit of game data so the JIT doesn't optimize the whole program away as dead code.
if (game.hero.pos.x >= -1) count++
watch.stop()
print("Generated $count dungeons in ${watch.elapsedMilliseconds}ms")Hrm, maybe. Python does well not using them - if you reassign something, it's being reassigned. Maybe, since declaration is more common, make declaration the default and reassignment explicit?
> Indenting loop bodys makes code more clear
Glad you agree.
> curly braces won't suddenly break
They do all the time, everytime indentation (how people read coe) gets out of sync with braces. Hence avoiding redundancy.
> Keeping lines short makes it nicer to work with in various editor setups.
Displaying code to match the screen is the editors job. Sometimes your screen is 30 characters, sometimes it's a lot more.
I don't understand why this myth is still around.
C++ never had a killer app to start its momentum.
Neither did Javascript. Nor Java really (or maybe applets, back in the days?).
Languages can succeed on technical merits alone if they come out at the right time and fix real problems that programmers experience on current mainstream languages.
1. Extreme compatibility with the current entrenched language so you can incrementally migrate. C++ from C. CoffeeScript and TypeScript from JavaScript. Kotlin from Java.
2. A killer app (well, framework). Rails for Ruby. WinForms for C#. Applets and J2EE for Java (later Android).
3. A new platform where you must use the language to target it. C for UNIX. Objective-C for iOS. JavaScript for the browser.
There are a few exceptions here and there, but the above are the typical well-trod paths to success for a language.
What was Python's killer app?
What is Rust's killer app?
Go's?
Kotlin's?
Java is a counter example to your claim #3 since it not only does it run on all OS'es but you can also develop it on all OS'es.
Not a killer app, but the fact you have so many ML frameworks
> What is Rust's killer app?
That's clearly Servo.
> Go?
It was docker which really made Go take off, it was their first big platform.
> Kotlin's?
Android compatibility, before that it was a niche language not being picked up much.
C++ was immediately adopted by all major C compiler vendors as it came from AT&T as well.
Microsoft C/C++ 7.0 for MS-DOS was the very last one to adopt C++ on the toolchain.
It was the lingua franca of all major desktop OS GUI frameworks, leaving C just for their lower layers, MS-DOS (Turbo Vision), OS/2 (C/Set++), Windows (OWL, VCL, MFC), Mac OS (PowerPlant, MacApp), BeOS, Symbian.
If you were doing plain C GUI programming you were doing it wrong.
> Neither did Javascript.
JavaScript owns the browser, there is hardly any other alternative regarding "browser systems programming".
> or Java really (or maybe applets, back in the days?).
Java's portability was a gift compared with C compilers still in the middle of migrating from K&R C to ANSI C, C++ compilers which were silos with their GUI frameworks and a standard still a couple of years away to be fully defined.
More than today?
https://de.indeed.com/viewjob?jk=6c49a2deeb389df8&q=rust&tk=...
https://de.indeed.com/viewjob?jk=6823f26122417b2d&q=rust&tk=...
I beat the Reversi app on first try. I'm guessing it's not very strong. :)
Haha yes I weakened the AI somewhat compared to the original version created by RedBrogdon. It's not fun to be constantly thrashed by an opponent who takes 0.2 seconds per move! Despite my changes I still lose about 3 out of every 4 games :(
Personal opinion time:
Lars and Kasper, the original leads and creators of the language came out very confidently with this mission to get Dart natively supported in the browser based on the assumption that the language was so good and the VM would be so fast that users would clamor it.
They had the best of intentions — they really did want to make a delightful, productive, fast language. They intended to move the entire web forward the same way V8 had when it first launched, and they believed deeply that Dart would enable that.
But I think they really underestimated how vastly different designing and marketing a language is from simply implementing an already-successful one.
It's not enough to just have a good product. The way you present it is often more important. And you don't even have the luxury of defining "good product" — you must be mercenary in letting your users' needs override your personal preferences. All of that was a real struggle for them.
For what it's worth, there's been a lot of staff changes over the years since Dart first launched. Lars and Kasper have left to try the startup thing again (which I think is a better fit for their skills and desires than evolving a big open source language). The team we have now, I believe, is much better aligned with what you're saying.
It sucks that we do have this baggage, but I hope we can improve our reputation over time. I'm hopeful we can — it took Java several tries before it found its footing.