enforce()?
Walter Bright
newshound1 at digitalmars.com
Sat Jun 19 17:04:31 PDT 2010
Andrei Alexandrescu wrote:
> On 06/19/2010 03:55 PM, bearophile wrote:
>> Inside Phobos2 I have counted about 160 usages of the "body" keyword.
>> I think contract programming can be used more often inside Phobos2
>> (and maybe some usages of enforce() can be turned into contract
>> programming because they are more similar to program sanity checks).
>
> Walter and I discussed this and concluded that Phobos should handle its
> parameters as user input. Therefore they need to be scrubbed with hard
> tests, not contracts.
I should add that any library that may be used as a dll should have its
interface API checked with hard tests, not contracts. This is because a dll
cannot control who connects to it, and therefore must regard anything sent to it
as unvalidated user input.
More information about the Digitalmars-d
mailing list