Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some of my earlier notes are in this thread (it is more about the day-to-day feature I actually use and like, and less about the fine details of the type system) https://news.ycombinator.com/item?id=13371009

Personally I don't get the hype around union types: at the point where you need to check which type you are working with, you may as well use a generic object (and maybe an assert if you are pedantic).

Intersection types may be a nice subtlety in an API, but I haven't encountered any need for it yet. Definitely not a game-changer.

I longed for non-nullable types, but as soon as Dart had the Elvis-operator (e.g. a?.b?.c evaluates null if any of them is null), it is easy to work with nulls. Also, there is a lot of talk about them (either as an annotation for the dart analyzer or as a language feature), so it may happen.

Mapped types are interesting indeed. In certain cases it really helps if you are operating with immutable objects, and mapping helps with that (although does not entirely solves it, because the underlying runtimes does allow changes to the object).



I agree about union types. They can quickly result in insane variable declaration statements that are hard to understand.

I dislike nulls though, I always wish people would just use a flag or error handling when objects are undefined, instead of "hey this object is the flag and sometimes it's not actually an object!"

You'd think language designers would learn after dealing with null pointers :)


So Dart hasn't really incorporated any lessons from 20 years of Java, has it? Google's answer to Tony Hoare's billion-dollar mistake is... "The Elvis operator"?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: