Re: Design by Contract

From: Date: Wed, 11 Feb 2015 07:12:04 +0000
Subject: Re: Design by Contract
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-82429@lists.php.net to get a copy of this message
Hi Dmitry and Joe, On Wed, Feb 11, 2015 at 4:02 PM, Dmitry Stogov <dmitry@zend.com> wrote: > I think we can't support contracts on interfaces and abstract methods. > How D works? D supports contract in structure and interface. Structure is more like classes in D, though. interface I { int foo(int i) in { assert(i > 7); } out (result) { assert(result & 1); } void bar(); } http://dlang.org/interface.html Eiffel support contracts for interfaces. class interface DICTIONARY [ELEMENT] feature put (x: ELEMENT; key: STRING) is -- Insert x so that it will be retrievable -- through key. require count <= capacity not key.empty ensure has (x) item (key) = x count = old count + 1 ... Interface specifications of other features ... invariant 0 <= count count <= capacity end -- class interface DICTIONARY https://archive.eiffel.com/doc/manuals/technology/contract/ If there is no technical difficulties, I would like to have it. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#82429) next »