Why can't we define re-assignable const reference variable?

Sergey Gromov snake.scaly at gmail.com
Sun Feb 17 10:17:10 PST 2008


Janice Caron <caron800 at googlemail.com> wrote:
> On 17/02/2008, Sergey Gromov <snake.scaly at gmail.com> wrote:
> > So it's really strange that you can't declare
> > const(C) x;
> 
> ???
> 
> You can!

But it wouldn't mean mutable reference to const data.  This /looks/ like 
const only affecting C, but, in fact, constness is expanded over the 
whole declaration.  I.e. the syntax for declaring reference to const is 
already in the language, the question is, why it's not in the type 
system.

-- 
SnakE



More information about the Digitalmars-d mailing list