Fully transitive const is not necessary

Janice Caron caron800 at googlemail.com
Wed Apr 2 12:16:54 PDT 2008


On 02/04/2008, guslay <guslay at gmail.com> wrote:
>  Saying that is logical const :
> <snip>
>  while this isn't:
> <snip>
>  is kind of a reach.

>From where I stand, it's true by definition. But I'll agree to use
your definition of logical const for the rest of this post (but don't
expect me to use it thereafter). So, by your definition a class which
contains member functions which are declared const and which modify
global variables, is logically const. Hmm... I called that "globby" in
another post.


> Those propositions merely point out that D const is just logical const anyway (even if it pretends not to be).

D doesn't pretend not be support classes which contains member
functions which are declared const and which modify global variables.
By your definition, D does not pretend not to be logical const. (Now
see why it's so confusing to have different definitions).


>  At the function level, const/invariant is nothing more that an abstraction.
I said that. No disagreement there. All it does is specify the
constancy of the hidden function parameter known as "this".

>  At the data level, const/invariant is enforced (bitwise const).
Again, I said that. No disagreement there.

So apart from a little bit of terminology, we're agreeing.



More information about the Digitalmars-d mailing list