Am 10.02.2015 07:25 schrieb "Yasuo Ohgaki" <yohg...@ohgaki.net>: > > https://wiki.php.net/rfc/dbc2
First of all, thanks for your effort so far. Some questions, after reading the RFC, with no particular order: 1) Regarding invariants: those will be called for method calls on objects. What about static class methods? Could we have static class invariants (static require(.....))? Would these be called for both static and nonstatic method calls (nonstatic method calls can change static class state, too) 2) the pre- and postconditions could be useful for ordinary, non-OO functions, too, to check parameters, return, and global state invariants 3) I think that method preconditions are not sufficient. Pretty often, public methods first sanitize and validate their input parameters, and rightly so. In these cases, it would be useful to have the checking, in the same general framework, at an arbitrary point in the function body. In other words, assert (with an expression as the first argument, instead of a string....). 4) regarding the error message second argument to the condition definitions, it would be useful to have these not only as plain (extrapolated) strings, but as full expressions-that-evaluate-to-string. That would permit hooking to arbitrary private logging and log formatting methods. 5) and a bit off-topic, it would be useful to be able to declare (sic) whole methods to be nonproduction only: Methods that will only be used in pre/post/invariant condition expresions (or error formatters a la my point 4) best regards Patrick