The Right Approach to Exceptions

Timon Gehr timon.gehr at gmx.ch
Sat Feb 25 05:19:24 PST 2012


On 02/24/2012 08:14 PM, Andrei Alexandrescu wrote:
> On 2/24/12 1:13 PM, H. S. Teoh wrote:
>> In my mind, contract code belongs in the function signature, because
>> they document how the function expects to be called, and what it
>> guarantees in return. It doesn't seem to make sense to me that contracts
>> would be hidden from the user of the library. Sorta defeats the purpose,
>> since how is the user supposed to know what the function expects? Rely
>> on documentation, perhaps, but docs aren't as reliable as actual
>> contract code.
>
> Yah, and that's why we managed, with great implementation effort, to
> allow contract checks in interfaces. The concept has still to take off
> though.
>
> Andrei

'In' contracts are hardly usable at all at the moment, because they are 
not inherited by default.


More information about the Digitalmars-d mailing list