Hi Dmitry and Joe,
On Wed, Feb 11, 2015 at 4:02 PM, Dmitry Stogov <[email protected]> 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
[email protected]