Hi Joe, You are welcome to edit https://wiki.php.net/rfc/dbc2 It looks like we have similar views, so just make it better in a way you think.
Thanks. Dmitry. On Tue, Feb 10, 2015 at 11:49 AM, Joe Watkins <pthre...@pthreads.org> wrote: > I'm happy to clean up the RFC after Dmitry's changes are merged. > > Happy to author some of the content if Yasuo is busy or wants help ? > > Cheers > Joe > > > On Tue, Feb 10, 2015 at 8:29 AM, Dmitry Stogov <dmi...@zend.com> wrote: > >> A bit updated version of RFC is attached. >> As I removed more than added, I decided not to put it on wiki before >> internal agreement. >> Actually, I would also remove most part of introduction as well, to make >> RFC more compact and clean. >> >> I cnahged $> into $ret, because $> just won't work. Some better solution >> is welcome. >> >> The RFC misses contract inheritance rules. They must be defined >> separately for preconditions, postconditions and invariants. >> Yasuo, could you please check, how it's implemented in D and add missing >> section. >> >> We will need English correction after all. >> >> Thanks. Dmitry. >> >> On Tue, Feb 10, 2015 at 11:19 AM, Dmitry Stogov <dmi...@zend.com> wrote: >> >>> completely agree. contracts must be permanent. >>> >>> Thanks. Dmitry. >>> >>> On Tue, Feb 10, 2015 at 10:40 AM, Joe Watkins <pthre...@pthreads.org> >>> wrote: >>> >>>> Example code never works, I can just say that's a bad abstraction, >>>> vertebrate and invertebrate are distinct and abstraction should reflect >>>> that. >>>> >>>> Why should we provide a way to change contracts is the question ? >>>> >>>> It doesn't seem to make sense to do that, a derived class should be >>>> able to define additional contracts, but not change the contracts of it's >>>> parent. >>>> >>>> Cheers >>>> Joe >>>> >>>> On Tue, Feb 10, 2015 at 7:36 AM, Yasuo Ohgaki <yohg...@ohgaki.net> >>>> wrote: >>>> >>>>> Hi Joe, >>>>> >>>>> On Tue, Feb 10, 2015 at 4:31 PM, Joe Watkins <pthre...@pthreads.org> >>>>> wrote: >>>>> >>>>>> Actually I'm not sure it's at all sane to try to override contracts, >>>>>> I'd actually avoid that completely, so no need to name contracts and no >>>>>> need for magic __invariant. >>>>> >>>>> >>>>> For example, >>>>> >>>>> class Animal { >>>>> protected $legs; >>>>> require($legs >= 0); >>>>> } >>>>> >>>>> class Snake extends Animal { >>>>> // Snake is fine, no leg >>>>> } >>>>> >>>>> class Human extends Animal { >>>>> // 2 legs. $this->leg === 2 >>>>> } >>>>> >>>>> Overriding makes sense for many cases. >>>>> >>>>> Regards, >>>>> >>>>> -- >>>>> Yasuo Ohgaki >>>>> yohg...@ohgaki.net >>>>> >>>> >>>> >>> >> >