unpaintable (the solution to logical const)

Janice Caron caron800 at googlemail.com
Fri Apr 4 23:01:56 PDT 2008


On 05/04/2008, Jason House <jason.james.house at gmail.com> wrote:
>  My only concern is that stuff like "always int x = 5" could be confused as a
>  constant.

And let's not forget, the most common use is likely to be to make a
mutable field, as in C++. Using a word that suggests const to make
something permanently not-const is going to serious compromise the
learning curve.

That's why I stuck with "unpaintable" for the description. It's a
visual metaphor that's easy to picture. You can imagine mutable as
white, invariant as grey, const as black, and operations like const(T)
as going over T with a pot of black paint. Unpaintable fields are
coated with varnish that paint won't stick to. It's not a bad
metaphor, but, is "paint" the right verb for "change the constancy?" -
I don't know.

I guess it's always indicative that an idea is generally liked, when
people start arguing about what to call it, so that's great. What I
would like to know, though, is this: Does anyone still think that this
"breaks the const system"? Is there any reason to suppose that Steve
and I missed something, and this will make the whole type system fall
over? After all, Walter said, and here I quote word-for-word: "I
suspect that logical const is like perpetual motion - if you think
you've solved it, you've just made a mistake somewhere". So that's the
question for me: is there a mistake somewhere? I can't see one, but I
was wrong before so that doesn't mean anything.



More information about the Digitalmars-d mailing list