std.locale

Daniel Keep daniel.keep.lists at gmail.com
Tue Mar 3 06:09:16 PST 2009



Walter Bright wrote:
> Georg Wrede wrote:
>> We've had Walter make nice features to D that were laborious to
>> create, only to see nobody use them. It's happened, ask him.
> 
> Sure. Often the only way to see if a feature is useful is to actually
> implement it and see what happens. Some features have succeeded and
> found uses far beyond my expectations (CTFE, string mixins) while others
> have pretty much languished (design by contract, complex numbers).

I've used complex numbers before, but only when rendering fractals.
Sorry :P

As for design by contract, my problem has always been this:

Contracts let you ensure that your assumptions about program state are
never violated.  That means checking pre- and post-conditions on
functions, and invariants for classes.  Which is great.

So I put contracts on everything.  Fantastic.  I do a release compile,
and all that safety disappears.  So only the debug build has contracts
enabled.  But it's the release build, if it crashes, that I need help
diagnosing.

There's also libraries.  If you put contracts on public APIs, then your
library is only checking arguments in debug builds.  This makes release
builds faster, but also less safe.  So do you only put contracts on
internal APIs and do manual exception testing on public APIs?

I like DbC, I really do.  I just have trouble figuring out where and how
to use it properly.

  -- Daniel



More information about the Digitalmars-d mailing list