Remix.run Logo
mrsmrtss 2 hours ago

I agree that changing object state and having side effects should be avoided, but you can achieve both immutability and encapsulation very easily with C#:

    public record Thing()
    {
        private string _state = "Initial";
        public Thing Change() => this with { _state = "Changed" };
    }