Re: Design by Contract
| From: | Dmitry Stogov | Date: | Wed, 11 Feb 2015 07:02:13 +0000 |
| Subject: | Re: Design by Contract | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82424@lists.php.net to get a copy of this message | ||
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 <yohgaki@ohgaki.net> wrote:
> Hi Dmitry and Joe,
>
> On Wed, Feb 11, 2015 at 6:29 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
>
>> On Tue, Feb 10, 2015 at 8:53 PM, Dmitry Stogov <dmitry@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
> yohgaki@ohgaki.net
>