Revised RFC on range design for D2

Sergey Gromov snake.scaly at gmail.com
Wed Oct 1 03:29:16 PDT 2008


Tue, 30 Sep 2008 23:58:14 +0800,
KennyTM~ wrote:
> P.S. *: "in" was "invariant scope". When did it changed to "const
> scope"??

I don't know whether it ever was invariant, but the current 
implementation is correct IMO: "in" contract means that you guarantee 
not to change the received object.  Const enforces exactly this 
guarantee.  Invariant is more restrictive in that it also requires a 
guarantee from the caller that the object will never change in the 
future, therefore disallowing mutable objects for "in" parameters.  This 
contract doesn't quite associate with an "in" keyword to me.


More information about the Digitalmars-d-announce mailing list