Destructors, const structs, and opEquals
Steven Schveighoffer
schveiguy at yahoo.com
Tue Dec 14 05:58:39 PST 2010
On Mon, 13 Dec 2010 17:54:57 -0500, Don <nospam at nospam.com> wrote:
> I can't really escape the feeling that 'const' guarantees too little.
> It makes guarantees to the caller, but tells the callee *nothing*.
This is the basis of my argument that adding logical const would not
compromise the guarantee of const, because it has no guarantees to begin
with.
But what const *does* do well is give you a good guard-rail to prevent you
from making dumb mistakes. Most people are not going to write code that
exploits the lack of guarantees, so it's a reasonable constraint.
The huge value of const is to unify both mutable and immutable parameters
into one function.
-Steve
More information about the Digitalmars-d
mailing list