Out contracts: how to refer to objects' start state
Adam D. Ruppe
destructionator at gmail.com
Sat May 25 18:18:56 PDT 2013
On Sunday, 26 May 2013 at 01:12:35 UTC, Andrei Alexandrescu wrote:
> On 5/25/13 9:03 PM, Andrej Mitrovic wrote:
>> On 5/26/13, Andrei Alexandrescu<SeeWebsiteForEmail at erdani.org>
>>> in { auto oldLen = this.length; }
>> out { assert(this.length == in.oldLen + 1); }
> Since every in.xyz expression could access an arbitrary method
> of the old object,
Here, in.oldLen refers to the local variable you defined in the
in{} scope, as opposed to plain oldLen which would be searing the
out{} scope.
More information about the Digitalmars-d
mailing list