Comment by grok2
8 years ago
Can you explain why you think the type system in Dart is great (or point me to something on the web that does this) -- AFAIK, that has never been made a selling point of the language.
(I have been considering Dart for a while, but haven't taken the time to look into it because it doesn't seem like it provides additional benefits compared to other languages (apart from the Flutter aspect).)
So dart has the concept of gradual typing, where some portion of the program is annotated and the rest is not. I'm not completely up to date on current dart, but for some time there was the concept of checked compilation sms unchecked. Now I think it's called strong mode.
Anyways, you could check for certain major structural errors in unchecked mode and compile very fast, and then when it's time to start propping up a release, you can turn on checked mode and catch more intricate errors.
Gilad has been working on gradual/optional type systems for years. (they are technically two different ideas but the difference is rather academic and of little use to most programmers)
Anyways, dart has strong generics, it can do contravariance easily which makes refactoring code without breaking existing call sites, the dart lang spec has a great section on this.
In addition to all this, dart has really good reflection support through mirrors, a concept I'm not very familiar with, but it makes possible a tool called observatory, which is awesome. You can have source maps for dart2js, you can see which individual classes or methods or even lines of code are being utilized, you can get a lot visualizations about your performance profile, you can look at dart from the inside of dart. It's a lot like smalltalk, but way more practical.
Sort of like how rails took a perfectly good language and destroyed it, flutter seems to have built a foundation for taking dart and exploiting it.
Now they say its client-oriented" which I assume is googlese for "if you're not using dart for flutter, fuck off."
There was also a dart llvm effort at one point, but that became too useful and was abandoned.
If you are looking for a really good functional language for web, consider F# if you have dotnet experience, or bucklescript if you have ocaml support, scalajs if you have jvm experience and also love shitty tooling, and finally, purescript if you like haskell.
HN likes Elm a lot, but it's a little too opinionated for me, and although I like the BDFL approach to FOSS, it doesn't mean that you should be the ONLY developer in the core. That makes me exceptionally nervous about adoption, especially for professional work.
YouTube search for "gilad is right" for some talks that he's given. There's one where he dives in depth to the type system and how checking works.
Sorry for no links, literally using 2G right now, travelling.
Thanks for the extended explanation. Lots of things to chew on.
Yeah, I am unhappy that they are focusing Dart more on the client side (another reason, I didn't look too closely at it) -- focus like that is probably good for language adoption in some niche, but it would be nice to have a good strongly typed language that also has good support, good tooling and extensive libraries for use both on the client side and the server side (and for mobile app development!) so you have only one language to deal with everywhere. Dart is one of the few languages that from the outside seems closest to that ideal.
Yeah exactly. I've followed gilads work for more than a decade, but they have managed this project in typical Google fashion.
I'm kind of at the age where I'm just too far removed to try and work on learning a whole new field. If I could go back, I think I'd choose type theory and compilers and spent longer in college. Instead I learned to reverse software and built my career up piecemeal, but there is so much fascinating material surrounding compilers and the intricacies of how different type systems behave and allow modeling. I see how people get their whole career sucked up into that space.
F# still has a chance if dotnet can step their game up just a few more notches. They're getting better lately.
You will probably be disappointed to know that dart is fully statically typed now (with type inference). Still a good language but missing it's dynamic soul. I too thought that gradual typing was a perfect balance.
Oh no!
Well.
What is Gilad up to now, I wonder?
For such a talented researcher, that's gotta be demotivating for him. Bless him.
I guess dart is basically ceylon now but with contravariance? Gradual typing gave it such a unique space.
2 replies →