4 ms·
> From what I can tell, there's no sum types Paraphrasing Qc Na: Subclasses are a poor man's sum type. Also, sum types are a poor man's subclasses. :) But, y
by munificent 8y ago
> From what I can tell, there's no sum types
Paraphrasing Qc Na: Subclasses are a poor man's sum type. Also, sum types are a poor man's subclasses.
:)
But, yes, some nicer notation for declaring a sealed family of types would be nice along the lines of case classes in Scala. It's something we've talked about a bunch but haven't had time to get to yet.
> I don't see any way to bound generics based on interface/typeclasses/traits
It uses the same syntax as Java:
class Foo<T extends Bar> {
T thing;
method() { thing.methodOnBar(); }
}
> it has no non-nullable types.
Not yet. :( I hope we can get to them.
- leshow 8y ago> Paraphrasing Qc Na: Subclasses are a poor man's sum type. Also, sum types are a poor man's subclasses. One of the great things about disjointed unions is (usually) exhaustiveness checking. Not to mention usually some form of pattern matching. Case classes would do the trick. It would be interesting to see those features in Dart, congrats on the release.