Re: Design by Contract
| From: | Dmitry Stogov | Date: | Fri, 06 Feb 2015 09:50:12 +0000 |
| Subject: | Re: Design by Contract | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82033@lists.php.net to get a copy of this message | ||
Just a thought: may be we can reuse part of PHP syntax and ask standard PHP
parser to do the work and provide AST.
<<requre(PHP_EXPRESSION)>>
<<weight(PHP_NUMBER)>>
I don't know if it's possible to implement...
Thanks. Dmitry.
On Fri, Feb 6, 2015 at 7:04 AM, Pierre Joye <pierre.php@gmail.com> wrote:
> On Thu, Feb 5, 2015 at 11:44 PM, Dmitry Stogov <dmitry@zend.com> wrote:
> > This is just a brainstorming, and we are not going to provide a working
> > solution tomorrow :)
> > You have enough time :)
> >
> > I don't like phpdoc approach because we have to define, parse and compile
> > new syntax for constraints.
> > Would constraint be able to call other functions? include external php
> > files? etc?
> > For me it's an overhead. We may reuse PHP syntax.
>
> Last time we discussed annotation a syntax reusing PHP short syntax
> for array came up. To keep it as simple as possible and let the
> application deals with the contents. It sounds like a good compromise
> and flexible enough.
>
> A possible key point is also the ability to use them while using the
> same source for both 5.x and 7.x. Not sure it is technically possible
> but this is something to keep in mind.
>