# [RFC] Design by Contract - Vote only RFC

- Thread: https://externals.io/message/84090
- Original archive: https://news-web.php.net/php.internals/84090
- Started by Yasuo Ohgaki on 2015-03-01T03:25:10+00:00
- Messages: 4
- RFC: Introduce Design by Contract (Inactive) — https://externals.io/rfc/introduce_design_by_contract.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #84090 — Yasuo Ohgaki — 2015-03-01T03:25:10+00:00

URL: https://externals.io/message/84090#84090

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

---

## #84091 — Stanislav Malyshev — 2015-03-01T03:32:52+00:00

URL: https://externals.io/message/84090#84091 · In reply to: #84090

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

---

## #84093 — Leigh — 2015-03-01T03:53:12+00:00

URL: https://externals.io/message/84090#84093 · In reply to: #84091

> 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.

---

## #84094 — Yasuo Ohgaki — 2015-03-01T04:25:22+00:00

URL: https://externals.io/message/84090#84094 · In reply to: #84091

Hi Stas,

On Sun, Mar 1, 2015 at 12:32 PM, 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?
>

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
