DConf 2013 Day 1 Talk 2: Copy and Move Semantics in D by Ali Cehreli
Dicebot
m.strashun at gmail.com
Thu May 16 03:25:48 PDT 2013
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.
More information about the Digitalmars-d-announce
mailing list