Hi all,

On Tue, Feb 10, 2015 at 5:27 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:

> On Tue, Feb 10, 2015 at 5:19 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
>
>> Use of interface:
>>   - no additional keyword (pros)
>>   - requires interface for DbC, most classes does not require interface
>> (cons)
>>   - if interface is not used, user has to repeat invariant conditions
>> over and over (cons)
>>   - requires to define method that should not exist in production (cons)
>>
>> New keyword:
>>   - does not require interface for efficient definition (pros).
>>   - new keyword (cons)
>>
>> It seems we are better to choose proper keyword for 'invariant'.
>> 'invariant' is not common, so 'invariant'
>> may be good enough choice. Does anyone use 'invariant' as
>> function/method/class/constant names?
>> If there is better name, suggestion is appreciated.
>>
>
> It might be be better to use special method. No keyword, use only reserved
> method name __func().
> I'll write what I think that are better for PHP in the RFC.
> We may discuss anything here to complete the RFC.
>

The RFC draft is ready.
https://wiki.php.net/rfc/dbc2

I think we might be better to use

return($ret) {
  assert($ret > 0);
}

as the syntax. It doesn't look like definition, but code though.

We may introduce $> or like as return value, but it looks like PERL.
It's not for me, but PHP stands for People Hate Perl for some.

Any comments, corrections, improvements are appreciated.
If anyone could fix bad English, it would be great!

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net

Reply via email to