Stepping back and looking at constness from another angle.
Reiner Pope
some at address.com
Wed Jun 6 23:25:21 PDT 2007
Another problem with const by default came to mind. Consider the
following code, with const-not-by-default:
void foo( ref const(char)[] c)
{
c = c[1..$];
}
I would hate to see this in const-by-default, which would try to wrap a
const( ) around the whole type. To counter that, you would probably have
to write some mess like
void foo ( mutable( ref const(char)[] ) c )
{
c = c[1..$];
}
-- Reiner
More information about the Digitalmars-d
mailing list