On 3/1/2019 12:14 PM, Brian Goetz wrote:
While the previous version was mostly about tradeoffs, this version
takes a much more opinionated interpretation of the feature, offering
more examples of use cases of where it is intended to be used (and not
used).

(Setting aside value records throughout.) A record type "codes like a class", not "codes like an int" -- you can `new` it, and the resulting record object has identity and can refer directly or indirectly to other record objects of the same type. (Contrast with LW1, "Value types may not declare fields of its own type directly or indirectly".) A variable of record type may even be null. The on-ramp to records looks smooth -- but can I compatibly turn a class type into a record type? It's potentially a source-compatible change (make the state description match the class's ctor), but binary-compatible?

Similarly, if a record type is chafing at the restrictions of "state only!", then can I (source|binary)-compatibly turn it into a class type?

Alex

Reply via email to