Suggested Change to Contract Syntax
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Thu Mar 10 17:45:36 PST 2016
On Friday, 11 March 2016 at 01:04:05 UTC, jmh530 wrote:
> On Friday, 11 March 2016 at 00:07:45 UTC, Jonathan M Davis
> wrote:
>>
>> You're not using in or out contracts here at all, so so of
>> course, you're not going to see how in/out contracts work with
>> inheritance in this example. To quote
>> http://dlang.org/spec/contracts.html:
>>
>
> Sigh...my point was that I was replacing the in/out contracts
> with what you were saying about asserts and scope(exit). Not
> that I have no idea what in/out contracts are.
Sure, but if you're not using in/out contracts with a class,
you're not going to see how they interact with inheritance. To
mimic what they do, you'd have to duplicate the base class
contracts in the derived class and make sure that you ||ed the in
contracts correctly and &&ed the out contracts correctly, which
isn't very maintainable.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list