|
|
|
|
|
by hamstercat
2161 days ago
|
|
I come from a TypeScript background, so I can compare it to that. The biggest difference to me was the soundness of the type system, where you're ensured (from a runtime perspective) that objects are correctly typed. This cuts both way: it was great not having to think about typings all the time around input/output, but it was also cumbersome when implementing the internal implementation. I'm a bit biased because I've come to think in term of structural typing much more. Typing in Dart reminded me more of my time with C#. Null safety was a huge missing piece though, glad to see it being added. |
|
For example, an integer that's used to index into an array, so it must be positive. Or a string that's a valid street address. You can maintain that info by packing it into a unique structure (ie, wrap in an object, using a unique key), but that's awkward to access. Or you can always pass around the parent object (eg, House), which has a unique structure, but then you're introducing unnecessarily tight coupling which is a disaster to maintain.