enforce()?

Michel Fortin michel.fortin at michelf.com
Wed Jun 16 17:45:47 PDT 2010


On 2010-06-16 14:59:45 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> Michel Fortin wrote:
>> On 2010-06-16 14:44:29 -0400, Michel Fortin <michel.fortin at michelf.com> said:
>> 
>>> On 2010-06-16 14:10:17 -0400, Jonathan M Davis <jmdavisProg at gmail.com> said:
>>> 
>>>> I would point out that pretty much nothing in std.contracts actually relates
>>>> to contracts. Rather, it relates to error handling. So, it would probably be
>>>> a good idea to simply rename the module - perhaps to std.error.
>>> 
>>> I concur: the module is misnamed. The only things not related to error 
>>> handling are assumeUnique and assumeSorted, and I fail to see the link 
>>> with design by contract for either one.
>> 
>> Oh, forgot about "pointsTo" too. What's the link with contracts, or 
>> error handling?
> 
> Certain functions (notably swap) must make sure that there's no mutual 
> aliasing between two objects.

Ok, so you're using "pointsTo" to check this in a contract? But isn't 
that just a utility function which can be used for contracts as much as 
for everything else? Does it really belong in std.contracts because at 
some place you use it in a contract? I don't think so. But that's 
something for you to decide. And unfortunately I'm not sure where you 
put it.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list