Closed
Description
The following construct should be avoided:
class Thing {
double x;
double y;
double z;
Thing(this.x, this.y, this.z);
Thing.empty() {}
}
Issues are:
- x, y, and z could become null if Thing is constructed via
empty()
.
The VM has a hard time optimizing fields that could be double or null. dart2js has a hard time optimizing field access that could be null.
Of course, I could set x,y,z to final. Or, I could eliminate empty() constructor.