Boost logo

Boost :

From: Nathan Myers (ncm_at_[hidden])
Date: 2000-07-29 03:10:55


On Fri, Jul 28, 2000 at 11:05:54AM -0400, Beman Dawes wrote:
> Nathan Myers wrote:
>
> >To choose a name, we should consider how it will be perceived by
> >people trying to read unfamiliar code. Maybe they just encountered
> >"boost::" and haven't memorized everything in it yet. How can we
> >help them?
> >...
> >Something that implies a "fait accompli" would be better, implying a
> >static condition rather than an action to perform. Then, we can
> >consider "checked" "proven", "verified", "known", "required". However,
> >grammatical correctness is why "assert" works so well, and none of
> >these last satisfy it.
>
> Action sounds better to me. How about "verify"?

Action implies that something is about to happen in the code,
rather than that it already has been done. That's the essence
of "compile-time" -- by the time you get to executable code,
it has been set in concrete; an active verb is actively
misleading.

I agree BOOST_COMPILE_TIME_ASSERT() would work, but, as I like to say
(until everyone is barking mad), "there's a lot to be said for brevity".

BOOST_PROVEN() is simply a lot shorter, leaving room for a lot
more expression in the parentheses. Likewise BOOST_BEHOLD() or
BOOST_WE_KNOW(). BOOST_STATIC_ASSERT() is at least shorter than
Dave's current favorite.

Remember how you encounter these statements: they appear in two
contexts. One is while reading code, where it records assumptions
made in the rest of the code. The other is when looking up a compile
error message referent, where it identifies a condition violated by
the current build environment. What does BOOST_COMPILE_TIME_ASSERT
communicate in each case? In the second, not much: you know it's
compile-time, because the compiler just told you. In the former,
it tells you a lot more than you need to know. In neither case does
the long name pull its weight.

So, I'll go to the wall fighting BOOST_POSTULATE(), tolerate something
clumsy like BOOST_COMPILE_TIME_ASSERT() or (better) BOOST_STATIC_ASSERT(),
but prefer something pithy and just-informative-enough, like BOOST_PROVEN()
or BOOST_CHECKED().
 
> >A side issue... it appears to me that the proposed expression would
> >not be appropriate for use in header files. Am I right?
>
> Sorry to be dense. I'm not seeing the issue. Could you explain?

If it only encodes the line number into the (hidden) typedef-name,
then there's nothing to keep two such statements that appear in
(e.g.) a header file and a .cc file or in two different header files
from defining the same typedef-name. Have I been croaking smack?

Nathan Myers
ncm at cantrip dot org


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