Unfortunately, the Dart web worker implementation isn't very convenient and I think some work could be done there to make it nicer to use. It's a very important use case for today's devices.
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.
- https://github.com/gcanti/newtype-ts
- https://github.com/Microsoft/TypeScript/issues/4895#issuecom...
but it isn't as nice as say Python's `typing.NewType` or Haskell's `newtype`
1: https://spin.atomicobject.com/2018/01/15/typescript-flexible...
2: https://basarat.gitbook.io/typescript/main-1/nominaltyping
- Overall the language is simpler and more regular, it's easier to read it.
- Async / await is way simpler and less mentally taxing than Kotlin's coroutines.
Also, Dart has code generation so you can write your own language features, like the freezed package which implements algebraic data types even though Dart doesn't have them natively.
I'm planning on writing a library in Dart that implements a custom TCP protocol, and I think ADTs would be the best fit for capturing all the valid states and error conditions. I really don't want to have a bunch of nullable fields or use the visitor pattern :/
I've been tracking this issue [0] and hopefully with the release of null safety, the team will have the time to implement ADTs!
Both feel highly verbose to me, but maybe that's just cos I'm used to something with quite minimal syntactic overhead.
Ultimately, they're very similar as languages so it wouldn't take long for a Typescript developer to picn up Dart or vice versa.