5 ms·
Interesting. 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. Use
by planede 4y ago
Interesting. 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.