Forums

contracts for interface properties?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

contracts for interface properties?

Postby blubb » Sun Oct 17, 2010 9:05 am

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
blubb
 
Posts: 3

Re: contracts for interface properties?

Postby Charles » Sun Oct 17, 2010 1:09 pm

Correct. Contracts are not properly supported in those areas. I'm not against it; just haven't done it.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 82 guests