I think we should just repeat the related D semantic. It must be defined in contracts inheritance rules.
What if we have contracts for prototype method in parent class and interface? Should we still validate contracts of parent and interface if we add our owns? etc. Thanks. Dmitry. On Wed, Feb 11, 2015 at 10:08 AM, Joe Watkins <[email protected]> wrote: > D has them: > > http://dlang.org/interface.html#interface-contracts > > Maybe we could allow pre/post contracts but invariants don't make sense on > interfaces. > > The question is, do we want to make them always available when possible, > or do we want to make them available where it seems most useful and or > least complex ? > > I prefer the latter, everyone else ? > > Cheers > Joe > > On Wed, Feb 11, 2015 at 7:02 AM, Dmitry Stogov <[email protected]> wrote: > >> I think we can't support contracts on interfaces and abstract methods. >> How D works? >> >> Thanks. Dmitry. >> >> On Wed, Feb 11, 2015 at 1:56 AM, Yasuo Ohgaki <[email protected]> wrote: >> >>> Hi Dmitry and Joe, >>> >>> On Wed, Feb 11, 2015 at 6:29 AM, Yasuo Ohgaki <[email protected]> >>> wrote: >>> >>>> On Tue, Feb 10, 2015 at 8:53 PM, Dmitry Stogov <[email protected]> wrote: >>>> >>>>> You are welcome to edit https://wiki.php.net/rfc/dbc2 >>>>> It looks like we have similar views, so just make it better in a way >>>>> you think. >>>>> >>>> >>>> Looks good to me. It's much better than original. Thank you folks. >>>> We have related issue like how internal module incorporate with DbC. >>>> However >>>> these could be future issues. >>>> >>> >>> A little more clarification, following interface definition is allowed >>> or not? >>> >>> interface Some { >>> >>> require($this->last_result > 1000); // Force classes to have >>> $this->result >>> >>> function bar($a, $b) >>> require($a > $b) >>> return($ret, $ret > 1000); >>> >>> function getLastResult() >>> return($ret, $this->last_result === $ret); >>> >>> } >>> >>> I suppose it is supported, but it may be better to be explicit. >>> >>> Regards, >>> >>> -- >>> Yasuo Ohgaki >>> [email protected] >>> >> >> >
