On Thursday, 16 May 2013 at 10:13:28 UTC, Regan Heath wrote:
...

I agree that this is a caller responsibility. What leaves me in doubts is how this responsibility is enforced though. With const nothing in type system prevents caller to violate that "contract" and mutate data during function call. Because, well, const does not guarantee that data is not mutated and thus it is a valid action.

Contrary, immutable is absolutely strict requirement from a function that caller must take care of passed argument during the function call or fall into undefined behavior. Explicit usage of "assumeUnique" by caller is clear sign for a type system "yes, I know what I am doing, I am responsible". And no accidents possible.

However, another issue arises then (my first comment), one I guessed "scope" may help with.

Reply via email to