> De : Ivan Enderlin @ Hoa [mailto:ivan.ender...@hoa-project.net]
> > Exactly, phpdoc is used as annotation (or comments with some similar
> > syntax) but is definitively not aimed to be annotations.
> Exact. Annotations !== comments. Because PHP has no annotation system,
> we used to use comments for this purpose, but it's a workaround.

It seems this discussion about DbC cannot remain on the DbC subject itself. 
Some claim we shouldn't add DbC because it would require a 'new language' (I 
don't see where...). Now, the discussion is about annotations, which are 
another subject as we don't need this to implement DbC. Well, annotations would 
be nice, but I won't wait for annotations to propose DbC !

What we need is to make an extension able to get control from the engine in 3 
locations :

- when a script file is read, before any parsing takes place. The file won't be 
modified but the extension will use that to read and internalize the 
constraints associated with the different script elements.

- When a method or function is called, after arguments are received, and before 
the function body is executed. There, we will execute the pre-conditions.

- Just after function return, but still in the function scope. There we will 
execute post-conditions.

Class conditions (invariants) are added to pre/post-conditions when appropriate.

Maybe this is already possible from a Zend extension, I don't know. But, even 
some of these hooks don't exist yet, they shouldn't be that hard to implement.

François




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to