version(CONTRACTS) for contracts?
Stewart Gordon
smjg_1998 at yahoo.com
Sun Nov 12 05:20:53 PST 2006
Bill Baxter wrote:
> BCS wrote:
>> I think what you are trying for is what class invariants do.
>>
>> http://www.digitalmars.com/d/class.html#invariants
>>
>> == Quote from Bill Baxter (dnewsgroup at billbaxter.com)'s article
>>> Is there a version statement that corresponds to whether or not
>>> contracts are enabled or not?
<snip>
> Still I don't think that covers all use cases. If my invariant is very
> slow to compute and I have some methods that are very frequently called,
> then I'm not going to want to check it for every single method call. It
> could make debugging way too slow. Plus, if I know these three methods
> are the only three that affect this invariant then only those three
> methods should trigger an invariant check.
So _check_data_structure_integrity is compiled only if DBC is enabled?
That's really a matter of compiler/linker optimisation. A design
principle of D is that language features to compensate for compiler
naivety are, in general, omitted.
> So I think something more fine grained than class invariants is needed.
> Something like version(_DContracts) would do it.
Why the name _DContracts?
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS-
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------
My e-mail is valid but not my primary mailbox. Please keep replies on
the 'group where everyone may benefit.
More information about the Digitalmars-d
mailing list