Closed MaryamZi closed 4 years ago
I think we can live the first; panic at runtime. @jclark thoughts?
It should be a runtime panic and not a compile-time error.
Consider the Employee
record. Absence of readonly
on a field does not mean writable, rather it means "may or may not be readonly". Since it is not a compile-time error to write to the name
field of something declared as Employee
, it should not be a compile-time error to write to the name
field of rec
.
Description: Consider a field update via a union of two records, where both have a field by the same name, but in one record type-descriptor it is a
readonly
field.IMO, we can allow this at compile-time, and if
rec
is actually aStudent
, we can panic at runtime with an inherent type violation error.Or should we disallow this at compile time?