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 >> > >