3 ms·
I guess it's more disappointment than anything else. I find: - syntax to be a step backwards. Useless tokens everywhere, distinction between expressions and st
by lucian1900 14y ago
I guess it's more disappointment than anything else. I find:
- syntax to be a step backwards. Useless tokens everywhere, distinction between expressions and statements, no macros or some other extension mechanism. Docstrings-in-comments. Silly operators like &&. Increment operators, even with post/pre distinction! The switch, with yet another form of fall-through. "new" keyword for creating objects. I thought we'd all learned that C/Java syntax is stupid.
- the distinction between production and development mode to be dangerous (no asserts in production). Behaviour differs enough to be confusing
- anything can be thrown. Why even bother with an exception type then?
- I see no value in specifying types if they aren't actually checked all the time. Generics are equally optional. We'll see if this experiment proves me wrong, but I doubt it.
- constructors are complex and confusing. For some reason they don't get inherited
- static methods. They aren't class methods, so why even bother? The docs even recommend not using them
- peculiar boolean context. For some reason, everything is falsy except for true
- no ADTs or at least non-nullable types
On the other hand, it gets many other things right (module system, less crazy semantics than JavaScript, properties, operator methods, libraries are saner, etc.). It's just sad that it could've actually been a nice language.
- pekk 14y agoThanks!
- jrockway 14y agoDart is basically Java Script. It's not called that because some language completely unrelated to Java called itself that already :) To reply to some of your points: The syntax is designed to look like Java. It's there for Java programmers, not to be the best syntax ever. (new is important, however, because you can also create objects with const.) Yeah, it's not Python. Production and development mode are a common optimization in other languages. Remember: type annotations in Dart cannot, by design, change the behavior of the application. So in production mode, that part of the language spec is enforced. Static analysis tools, etc., are free to do whatever they want, however. I'd rather catch type errors at code review time rather than at runtime in production anyway. The constructors make sense to me. They work like Java, and there is better syntax for initializing fields (which is all I ever do in constructors anyway). Ultimately, it's Java in client-side form. Compare it to GWT, not Python or Haskell.
- lucian1900 14y agoRight, and I think that's precisely what's wrong with it. It's only slightly better than both Java and JavaScript, but not an appreciable improvement otherwise. I'd have hoped for a more interesting language for such an interestingly pedigreed VM.
- jrockway 14y agoAs a programming language, Dart isn't particularly interesting, but as a tool, it's very interesting. You can actually write client code that can be reused: as your web UI, as your smoke test, as a Chrome extension, etc. And it's easy to write tests for, with Hamcrest-style matchers.