On Saturday, 30 July 2022 at 06:04:16 UTC, ag0aep6g wrote:

Yes. Here's a modified example to show that you can also violate `immutable` this way:


It's possible to do this because it's immutable. You don't need an extra update() function anyway.

```d
void main()
{
    auto s = S("test A");
    s.update = (_) { s.s = _; };

    s.update("test B");
    assert(s.s == "test B");

    s.s = "test C";
    assert(s.s == "test C");
} // No compile error...
```

SDB@79

Reply via email to