Denis Koroskin wrote:
<snip>
Nice, but I don't like the proposed syntax much, especially these:

cast(!const BaseClass[])
cast(!const const(int)[][])

I believe it would be better to split them into two separate casts as follows:

BaseClass[] base = cast(BaseClass[])cast(!const)derived;

Won't work. DerivedClass[] still needs to convert to const(BaseClass)[], not to BaseClass[]. Would have to be the more long-winded

    BaseClass[] base = cast(!const) cast(const(BaseClass)[]) derived;

and moreover, there'd be no way to do the casts to const(int)[][].

Unless you want cast(!const) to cast to a purely internal intermediate type that suppresses const-checking altogether.

Stewart.

Reply via email to