Yet Another Const Proposal
Sönke Ludwig
ludwig at informatik_dot_uni-luebeck.de
Fri Dec 7 13:51:32 PST 2007
Janice Caron wrote:
> On 12/7/07, Sönke Ludwig <ludwig at informatik_dot_uni-luebeck.de> wrote:
>> I'd be glad to hear any suggestions or mistakes I may have made.
>
> I have no suggestions, and haven't spotted any mistakes. In fact, good
> catch on the invariant overwriting problem!
>
> But I have to ask - what's the problem with Walter's latest
> suggestion? It seems absolutely perfect to me. I can't fault it. What
> do think it doesn't do, that we need?
>
My main (only?) concern are tail-const classes. If they had a transparent
syntax, I wouldn't care for them to be a special case. But using a template
makes it feel strange - but that can probably be resolved using macros
[TailConst!(X) -> tailconst(X)]. Another problem with templates is, that it is
currently not possible to transparently wrap a type in a struct. But that should
be resolved at some point, so it should only be a temporary problem.
The second thing is that I think from a language point of view it's unclean to
not be able to provide such a typing-feature without bypassing the type system
(casting away the const/invariantness at some point).
However, if only point 2 remains, I think, from a users point of view, such a
system would probably be as clean as it would get. So actually, I'm not really
sure which one I would prefer right now <g>.
More information about the Digitalmars-d
mailing list