Out contracts: how to refer to objects' start state

deadalnix deadalnix at gmail.com
Mon May 27 02:06:57 PDT 2013


On Monday, 27 May 2013 at 07:42:44 UTC, Jonathan M Davis wrote:
> On Monday, May 27, 2013 09:37:38 deadalnix wrote:
>> On Sunday, 26 May 2013 at 00:43:36 UTC, Andrei Alexandrescu 
>> wrote:
>> > That was technically difficult to do back then, and fell by 
>> > the
>> > wayside. Today it would break too much code to introduce even
>> > if feasible.
>> 
>> Can you expand more on the breakage risk please ?
>
> If nothing else, it would mean that the variables inside of the 
> in block would
> not go out of scope when the in block ended, so their 
> destructors would not be
> called and the like, whereas now they would be. The same goes 
> for scope
> statements in the in block. I don't know how much of an issue 
> any of that is
> realistically though. But Andrei may have other reasons why it 
> would be a
> problem.
>

You are right, destructor is an issue. The risk of name collision 
exists as well but I don't think it is realistically that 
widespread in actual codebase.


More information about the Digitalmars-d mailing list