The Status of Const
Walter Bright
newshound2 at digitalmars.com
Fri Aug 13 16:35:49 PDT 2010
Steven Schveighoffer wrote:
> I like how it reads naturally. I think it's also syntactically
> unambiguous. Walter, please give this one some attention, I'd love to
> see this fixed.
This was endlessly discussed maybe 3 years ago. I probably invested over a
hundred hours in trying to make it work.
It doesn't work.
It wasn't the syntax. There were many syntaxes proposed. The type system loses
its coherency with such a special case in it. Generic code has weird problems,
type deduction gets strange, types lose their composability, etc.
But there is a solution:
const(Object)* o;
Yes, under the hood it's 2 levels of indirection. But it works, it requires no
special syntax, it is completely consistent with the rest of how the type system
works, there are no corner holes in it, etc.
More information about the Digitalmars-d
mailing list