Re: Design by Contract

From: Date: Tue, 10 Feb 2015 07:27:02 +0000
Subject: Re: Design by Contract
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to internals+get-82342@lists.php.net to get a copy of this message
> One reason I would like to use __invariant() is to allow overriding parents. Well, another approach would be optionally named contracts: class Some { require contractName (invariant-expr); /* ... */ } This would also improve default error messages as a by-product. Cheers Joe On Tue, Feb 10, 2015 at 7:06 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > Hi Joe, > > On Tue, Feb 10, 2015 at 3:59 PM, Joe Watkins <pthreads@pthreads.org> > wrote: > >> I'm not sure we can always enforce invariant contracts ... >> >> Evaluating invariant expressions on entry and exit is not enough, since a >> property can be changed without the use of a method. >> >> Can or should, we do anything about that ? >> >> This should also be covered in the RFC, I think. >> > > One reason I would like to use __invariant() is to allow overriding > parents. > I think we should have way for it, but I don't have good idea now. > I'm still thinking. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net >

« previous php.internals (#82342) next »