Static versus dynamic binding of in contracts again - trying to set things straight

Regan Heath regan at netmail.co.nz
Wed May 9 03:55:27 PDT 2012


Reading that summary, and deadalnix's further comment I am inclined to  
agree that contracts should be (a) static.

It also made me think.. are we defining in/out contracts in the wrong  
place?  or in the wrong way?  What if we defined them on interfaces  
instead of classes?  After all, interfaces are the other form of contracts  
that we use in OOP and it would make sense to me that an in/out contract  
defined on an interface would be static, and would not change dynamically  
with sub-classes etc.

Perhaps we could have both static and dynamic contracts?  Contracts  
defined on classes (not interfaces) could remain dynamic as they are  
currently, but contracts defined on interfaces could be static.  Giving us  
the best of both worlds.

Regan

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list