2.011 invariant question
Sönke Ludwig
ludwig at informatik_dot_uni-luebeck.de
Sat Feb 23 08:20:41 PST 2008
Sönke Ludwig wrote:
> So ideally, whenever you get hold of a reference/pointer to invariant data,
> you should be able to store it and assume that it will never change.
> Is change in semantics (work on the compiler) is worth it in this case?
> I don't know. I can live with it this way, too - but nevertheless, it would
> be a similar generalization like with full-closures (and might be nice even
> for non-invariant data, or maybe it's overkill).
>
Incidentally, this idea just came up in a thread on D.learn (although the
post contains some oversights):
http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=11410
Although this would create some performance pitfalls, it would definitely make
the language much more robust and remove a whole class of bugs. And those
kind of bugs are pretty frequent mainly among beginners of C-like languages.
More information about the Digitalmars-d
mailing list