Let's not make invariants const
Christophe Travert
travert at phare.normalesup.org
Sat Aug 4 03:40:15 PDT 2012
"Era Scarecrow" , dans le message (digitalmars.D:174206), a écrit :
> I would think it does however during verbose output specifying
> if an invariant or contract is changing data and that may alter
> behavior.
Signatures in some place should be by default const, pure, nothrow. This
is the case for invariant() (if you consider it as a function) [1].
However, it is only possible to have different default than non-const,
non-pure, throw, if the langage support a way to remove those default
attributes. Maybe this should be included in the langage.
--
Christophe
[1] Actually, I would rather have a langage where all functions are by
default const (wrt all parameters, except this), pure, nothrow... But
it seems D is not that langage and it not going to be.
More information about the Digitalmars-d
mailing list