Page 1 of 1

contracts for interface properties?

PostPosted: Sun Oct 17, 2010 9:05 am
by blubb
Hi,

I am playing around with contracts and can't get the following code to run:

interface Food

get healthValue as int
ensure result > 0


The error I get is
Code: Select all
oops.cobra(4,9): error: Expecting DEDENT, but got "ensure" instead.
Compilation failed - 1 error, 0 warnings


It seems contracts are not supported in interfaces or abstract classes. Is that correct?

Regards,

blubb

Re: contracts for interface properties?

PostPosted: Sun Oct 17, 2010 1:09 pm
by Charles
Correct. Contracts are not properly supported in those areas. I'm not against it; just haven't done it.