const by default.
BCS
BCS at pathlink.com
Wed Jul 5 12:21:19 PDT 2006
Deewiant wrote:
>
>
> I think there's a problem with all this "grant mutability/immutability", which
> is that we're just degenerating into C++ with its const_cast. With it, the
> compiler has few, if any, guarantees about the constness of anything --- it can
> always be casted away.
Casting away mutability (unless I'm totally nuts) is always safe.
Casting away immutability should never be allowed.
>
> The way I see it, something either is or isn't mutable, and it should stay that
> way for the duration of the program --- in some cases, for the duration of a
> function or the lifetime of an object.
Each specific reference *would* be mutable or immutable for it's entire
duration. It would be a compile time attribute of a reference. The only
time that the mutability of a reference would change is when it is
copied to another reference, in a function call for instance, and then
the only change that can be made is the new reference can *lose* mutability.
More information about the Digitalmars-d
mailing list