Only want to say

Schrom, Brian T Brian.Schrom at pnnl.gov
Tue Jan 12 20:40:28 UTC 2021


On Tue, Jan 12, 2021 at 09:04:14AM -0800, H. S. Teoh via Digitalmars-d wrote:
> Check twice before you click! This email originated from outside PNNL.
> 
> IMNSHO, if contracts are hideous and unhelpful, then they're not being
> used properly.  Contracts are supposed to document (and enforce) what
> the caller must fulfill when calling the function; they should be in a
> form that's readable and understandable to the user.  Any other
> conditions that don't fall in that category belong as asserts in the
> function body, not in the contract.
> 

It seems to me that contracts being attached to, and enforced by, the
data types compose so much better than on the function.  I'm not
quite sure what that paradigm is called or if it's even feasible to
do with D's C legacy.  

Maybe struct and invariant do exactly what I desire.  I haven't
tried it or seen much example use of it though.


More information about the Digitalmars-d mailing list