Continued looking at properties in D - interfaces and constraints

Antonio Corbi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 12 00:43:45 PDT 2016


On Wednesday, 12 October 2016 at 06:20:05 UTC, mikey wrote:
> On Sunday, 9 October 2016 at 14:06:42 UTC, Antonio Corbi wrote:
>> 1. Inheritance with contracts is evaluated in a special way, 
>> 'in contracts' in the base and derived method (property) are 
>> or-ed, so if one of them passses, the contract is believed to 
>> have succeeded. As you don't have a contract in the 
>> base-method: "@property void width(int width)", I think that 
>> the compiler assumes that its empty contract is always true.
>
>
> Doesn't sound right to me. "Or"ing contracts with different 
> inherited methods can't possibly be a feature. I'll create a 
> bug report for it.

Hi Mikey,
It's the way DbC (Design by Contract) works, have a look at point 
8 in 
https://www.eiffel.com/values/design-by-contract/introduction/

Antonio


More information about the Digitalmars-d-learn mailing list