[RFC] Design by Contract - Vote only RFC

php.internals

Yasuo Ohgaki

11 years ago
Hi all, https://wiki.php.net/rfc/introduce_design_by_contract This is vote only RFC for 2 competing Design by Contract(DbC) RFCs. Please comment if you have any for this RFC. I'll post RFC discussion for actual proposals soon. Please keep discussion only about how vote should be done. Thank you. Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Stas Malyshev

11 years ago
Hi!
> Hi all, > > https://wiki.php.net/rfc/introduce_design_by_contract > > This is vote only RFC for 2 competing Design by Contract(DbC) RFCs. > Please comment if you have any for this RFC.
I don't see why the first one needs any vote. It is supposed to be implemented as an extension, so why not go and implement an extension, and put it in PECL, and then propose it for core inclusion, if it proves popular? As for the second one, do we really need the syntax change that would just move asserts to before { instead of after? If we already have zero-cost asserts, why just not use them?
-- Stas Malyshev smalyshev@gmail.com

Leigh

11 years ago
On 1 March 2015 at 03:32, Stanislav Malyshev <smalyshev@gmail.com> wrote:
> I don't see why the first one needs any vote. It is supposed to be > implemented as an extension, so why not go and implement an extension, > and put it in PECL, and then propose it for core inclusion, if it proves > popular?
Agree
> As for the second one, do we really need the syntax change that would > just move asserts to before { instead of after? If we already have > zero-cost asserts, why just not use them?
Agree @yasuo. The votes are closed.

Yasuo Ohgaki

11 years ago
Hi Stas, On Sun, Mar 1, 2015 at 12:32 PM, Stanislav Malyshev <smalyshev@gmail.com> wrote:
> > https://wiki.php.net/rfc/introduce_design_by_contract > > > > This is vote only RFC for 2 competing Design by Contract(DbC) RFCs. > > Please comment if you have any for this RFC. > > I don't see why the first one needs any vote. It is supposed to be > implemented as an extension, so why not go and implement an extension, > and put it in PECL, and then propose it for core inclusion, if it proves > popular? >
It's possible option with PHP7's AST.
> > As for the second one, do we really need the syntax change that would > just move asserts to before { instead of after? If we already have > zero-cost asserts, why just not use them?
Assertion only DbC has limitations. - Invaliants - Postconditions Without native DbC support, it ends up with messy code which is harder to read. Less code readability decreases maintainability. Therefore, it increases chance of bugs. This is the reason why there are languages/extensions for DbC in other languages. Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net