RE: [PHP-DEV] Design by Contract
| From: | F & N Laupretre | Date: | Tue, 10 Feb 2015 17:00:36 +0000 |
| Subject: | RE: [PHP-DEV] Design by Contract | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-82387@lists.php.net to get a copy of this message | ||
Hi Alexander,
> De : Alexander Lisachenko [mailto:lisachenko.it@gmail.com]
>
> This is built on top of reflection+annotation+parser extension.
> Why not to implement this for PHP? From my point of view, this is just an
> additional feature, that can be used by limited number of developers.
I like the idea. IMO, DbC directives should be defined outside of function body. I proposed doc
blocks because it exists and is already parsed but a generic syntax for annotations along with a
full API to interact with extensions would be much better.
Most important : if we define that, for example, everything outside of a class/function enclosed in
[], is an annotation, it is easy to enhance PHP 5 to ignore such syntax, without having to backport
the whole feature. So, people can start using it for PHP 7 and keep the possibility to run their
code under PHP 5. That's something that would be much harder with the current dbc2 proposal.
I will modify my RFC (https://wiki.php.net/rfc/dbc) to open it to any sort of annotations.
Do you think you have enough time to write something in due time ? Ask for help if you need.
Regards
François