Fully transitive const is not necessary

Janice Caron caron800 at googlemail.com
Wed Apr 2 10:31:11 PDT 2008


On 02/04/2008, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
> Sure.  Now I'll restate what I have been stating in these terms:  globby
>  classes are EQUIVALENT to logically const classes (or "muty" classes as you
>  call them).  Since they are equivalent, and we can have globby classes today
>  with transitive const, so what is the problem with allowing muty classes?
>  How would this break the const system?

Great! I understood. (I disagree, but I understood).

OK, in what sense are globby classes equivalent to muty classes?
Because, you see, I don't think they are. When you modify a global
variable, you are modifying something /else/, something other than the
class. In no way can this be said to be violating transitive const.
But when you modify a mutable variable in C++ (and I have to use C++
as my example, because it's not legal in D), then you /have/ violated
transitive const. That difference makes them seem not equivalent to
me.



More information about the Digitalmars-d mailing list