Am 10.02.2015 08:25 schrieb "Yasuo Ohgaki" <yohg...@ohgaki.net>:
>
>> 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)
>
> Do you mean enable DbC partially? Like
> declare(dbc=1);
> At the top of script?

Nono. i shouldn't have said declare, sorry.

What I meant is this (using a made-up keyword "dbconly" just for
exposition):

class foo {
   function normalmethod($arg)
       require($this->just_for_dbc_check($arg))
   { .... }
   dbconly function just_for_dbc_check($arg) {
       ... whatever validation code ...
       return false;
   }
}

And then when DbC is inactive (production) metho just_for_dbc_check would
not be compiled at all / invisible.

I now realize that I'm asking for a way to have arbitrary PHP code for
checking, through a backdoor :)

But this _would_ permit some nice consolidation of more complex checks,
ones that maybe would be shared by several methods with repetition of the
expressions in the case we cannot do this.

Just thinking out loud, I fully agree with Dmitry's comment of keeping it
simple and manageable at the moment, and this is something that could be
added later at any time.

best regards
  Patrick

Reply via email to