Const Ideas
Craig Black
cblack at ara.com
Fri Nov 30 11:19:53 PST 2007
"Craig Black" <cblack at ara.com> wrote in message
news:fipnds$ktf$1 at digitalmars.com...
>
> "Robert Fraser" <fraserofthenight at gmail.com> wrote in message
> news:fipn3b$j8n$2 at digitalmars.com...
>> Craig Black wrote:
>>> const(ref) const X x; // Everything is const, nothing is mutable
>>
>> One too many consts. I will not stand for any solution taht has "const"
>> more than once in the declaration.
>
> Right. I wasn't thinking straight when I proposed this as Janice pointed
> out.
> Simply
>
> const X x;
>
> will do the trick.
I still like const(ref) though, but it doesn't solve the problem of allowing
mutable references to const data. That would would still require something
like
const(X) x;
Which brings us back to where we are already. Another idea is,
mutable(ref) const X x;
Which is convoluted. Also I don't think that mutable is a keyword anyway.
More information about the Digitalmars-d
mailing list