You're Doing In-Conditions Wrong

Steven Schveighoffer schveiguy at gmail.com
Tue Jul 14 13:59:10 UTC 2020


On 7/14/20 9:49 AM, Adam D. Ruppe wrote:
> On Tuesday, 14 July 2020 at 13:37:58 UTC, Steven Schveighoffer wrote:
>> If you do nothing, what are the chances that
>>   a) you know about the contract, and actively decided in(true) is the 
>> correct contract for your subtype, and also knew that not providing a 
>> contract was the equivalent of in(true) so just didn't write it.
> 
> It is actually `in(false)` to inherit the parent's contract. in(true) 
> means you accept anything and everything. kinda nuts lol
> 
> http://dpldocs.info/this-week-in-d/Blog.Posted_2019_12_02.html

Not providing a contract is in(true). My point is, what do you think the 
chances that not providing a contract when the parent class does means 
that you want to accept all inputs, or that you didn't care about 
contracts at all?

You should have to explicitly say in(true) in the derived class if 
that's what you intended.

-Steve


More information about the Digitalmars-d mailing list