4 ms·
I think a lot of what people found off-putting about Dart is that Google already recently came out with a new language that has become very successful. Announci
by kbd 8y ago
I think a lot of what people found off-putting about Dart is that Google already recently came out with a new language that has become very successful. Announcing another one, which at first glance looks like yet another curly brace language not that far from Java, was a step too far for people to be interested.
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.
- munificent 8y agoI could be wrong, but I don't believe the existence of Go was much of a problem. Go and Dart are very different languages aimed for very different use cases. If anything, I think Go helped us because we could point to it as a successful language that Google hasn't cancelled. > 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.
- wmfiv 8y agoThat is nice. It's also almost indistuishable from Java 10. The string interpolation at the end is the last big syntactic nicety Java is missing - at least relative to this example.
- kbd 8y ago> I do think it's a good bit simpler and cleaner than it would be in Java. 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.)
- nailer 8y agoI removed everything that seems redundant. Less syntax means less to break, and less for new programmers (who are 10x the volume of existing programmers) to learn: 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")
- deleted 8y ago[deleted]