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 <dmi...@zend.com> 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 <yohg...@ohgaki.net> wrote: > >> Hi Dmitry and Joe, >> >> On Wed, Feb 11, 2015 at 6:29 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: >> >>> On Tue, Feb 10, 2015 at 8:53 PM, Dmitry Stogov <dmi...@zend.com> 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 >> yohg...@ohgaki.net >> > >