const debacle

Walter Bright newshound1 at digitalmars.com
Fri Mar 21 12:17:55 PDT 2008


Steven Schveighoffer wrote:
> So your answer essentially is, there is no way to specify that the function 
> will not modify the parameter but returns the same type passed in?

Right.

> Which means there is no check by the compiler to guarantee that source is 
> not modified (unless T is const), and basically, the coder has to rely on 
> the documentation to determine whether source will remain intact?  I think 
> this degrades the benefits of const in this context.

There's been some discussion about this, but no good resolution. (C++ 
has the same issue, btw.)



More information about the Digitalmars-d mailing list