muatbility must be marked in classes instead of immutability
remove let/val from. primary constructors and properties. allow for mutable keyword
public mutable name : String? instead of public name string? {get; set; } and public name: String?
if a property is mutable the type must be mutable
methods may not mutate state only constructors may set state
public mutable class Person { // forced mutable, because one property is mutable
public constructor (
public mutable name: String; // mutable. meaning it as a set and a get
public birthday : Date; // immutable. it only has a get
);
}
public mutable name : String?
instead ofpublic name string? {get; set; }
andpublic name: String?