Re: Updated document on data classes and sealed types

2019-03-02 Thread Remi Forax
So records are only immutable, it's a bold move and i like that. For beginners we offer a simple model with immutable named tuples and mutable List and Map, very like Python. I still think we should restrict sealed to interface only (you can always retrofit a class or an abstract class to add a

Re: Updated document on data classes and sealed types

2019-03-02 Thread Brian Goetz
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? Yes.  You can transform     class Point {     final int x, y;     public Point(int x, int y) { this.x