The Right Approach to Exceptions

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Feb 24 11:14:45 PST 2012


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


More information about the Digitalmars-d mailing list