Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-01 16:25:45


"E. Gladyshev" <egladysh_at_[hidden]> writes:

> According to Dave (if understood him right),
> it is Ok to call not just a public method of the same type
> but any method of any type internally
> while the invariant is broken.

Not exactly. If the function (or method) is known to use the object
being modified, you probably can't call it. For example, when two
objects reference one another you probably don't want to call one from
another's implementation while the invariant is broken. The case
where the object being modified happens to be global state which can
be accessed through any callback function, however, is a degenerate
consequence (as Brian says) of state. If you try to consider those
degenerate cases when designing programs, you almost can't even use
any libraries. This is one reason that language theorists like
functional programming languages. The real world of stateful
languages breaks down at the edges when you apply theory to it.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk