const challenge

Christopher Wright dhasenan at gmail.com
Sun Feb 3 17:27:38 PST 2008


Janice Caron wrote:
> On 03/02/2008, Christopher Wright <dhasenan at gmail.com> wrote:
>> More simply, catenation of a mutable variable with a non-mutable one
>> could yield a mutable one by default. A const cast is safer than a
>> non-const cast, after all.
> 
> Except that "non-mutable" doesn't necessarily mean const, and
> "non-const" doesn't necessarily mean mutable. I think you left
> invariant out of the mix there.

My suggestion was:
invariant(char)[] ~ char[] yields char[]
const(char)[] ~ char[] yields char[]

For clarity:
invariant(char)[] ~ const(char)[] yields invariant(char)[]



More information about the Digitalmars-d mailing list