interfaces and contracts - new pattern
Robert M. Münch
robert.muench at saphirion.com
Tue Dec 3 14:24:15 UTC 2019
On 2019-12-03 13:00:49 +0000, Adam D. Ruppe said:
> On Tuesday, 3 December 2019 at 10:39:08 UTC, Robert M. Münch wrote:
>> In large scale projects this will become a big problem as you can't
>> assume that every developer knows about all the contracts of a
>> superclass.
>
> That's the beauty of `override in(false)` - you don't have to know
> about the superclass. You can use it and it works in all cases.
My point was, when the superclass doesn't has an in() contract:
Error: function contracts.Derived.test cannot have an in contract when
overridden function contracts.Base.test does not have an in contract
So, I need to know that the superclass has a contract and that I want
to fallback to it. The former is the hard part.
> Though that's also a possible argument for the language change.
Yes, but only if the superclass has an in() contract.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
More information about the Digitalmars-d-announce
mailing list