On Thursday, 5 September 2019 at 21:22:12 UTC, Ali Çehreli wrote:
If it makes for the type to have immutable (or const) members, then fine; with the understanding that objects of that type cannot be assigned or mutated any other way, we can define them like that. What I meant is, because we want to use such a type in an AA and we don't want the element to change should not dictate the type's members. Using in an AA should be yet another usage of the type.

Got it. ;-)

> if immutable were that useless, why would it exist
> at all?

immutable is useful: You can have immutable objects, immutable AAs (different from what we are discussing here), etc.

So, what I'm just trying all the time is not to have a struct with immutable elements but a immutable struct-object with mutable elements. I think, that's what I confused all the time.

As a general rule, I never make members const or immutable; this is a guideline that I carried over from C++.

I have almost no experience with C++, but I just accept that as a good advise. After all that discussion here, it seems to be sound.

Thank you very much too! I think I made a big jump forward in understanding the concept of immutability in the last 24 hours. :-)

Reply via email to