Destructors, const structs, and opEquals

Jesse Phillips jessekphillips+D at gmail.com
Mon Dec 13 17:25:40 PST 2010


Don Wrote:

> I can't really escape the feeling that 'const' guarantees too little.
> It makes guarantees to the caller, but tells the callee *nothing*.

But it tells the callee exactly what it does, (assuming you unintuitive associate that const objects can be modified). To me const is nothing but a middle man. It allows you to call functions with both immutable and mutable object types. Which is only similar to @trusted and similar in goals as templates or even 'auto ref'

> BTW the really big problem I have with 'auto ref' is that it isn't 
> 'auto', and it isn't 'ref'. I wouldn't have the same objection to 
> something like 'autoref'.

I agree here. Makes it seem like you should also have 'auto immutable' and the likes. Maybe there would be reason to look at how we can consolidate all of this. But personally I am not familiar with the problems.


More information about the Digitalmars-d mailing list