4 ms·
In fairness, Dart took the fully-sound approach and while it is clearly better, it does make dealing with class member variables a massive pain for similar reas
by IshKebab 4y ago
In fairness, Dart took the fully-sound approach and while it is clearly better, it does make dealing with class member variables a massive pain for similar reasons.
Also clearly a bit of unsoundness is way better than just no type annotations at all, which is the alternative.
- planede 4y agoInteresting. It looks like it just doesn't allow narrowing types of class members and globals, sidestepping this whole issue. I like the Dart approach here. Users of the language can always bind a local variable to the thing you want a narrower type for, it's not the big of a hassle.
- IshKebab 4y agoIt is quite a hassle when every method looks like void foo() { var local_a = this.a; var local_b = this.b; ... this.a = local_a; this.b = local_b; } But I'd say it's still worth it for the soundness. And I have confidence they'll come up with some improvement. Maybe a way to opt out of setters/getters.