|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-12-16 18:48:47
----- Original Message -----
From: "David Abrahams" <dave_at_[hidden]>
> >> BTW, IIF always bothered me when I saw it; it's non-memnonic, and I
> >> never knew what it did. IF_BOOL would have been better in that
> >> respect.
> >
> > It stands for "inline if" because it is doesn't do any checking. The
> > condition *must* be 1 or 0 period. BOOST_PP_IF is implemented in terms
of
> > BOOST_PP_IIF, but using BOOST_PP_IF when the condition is guaranteed to
be 0
> > or 1 is a waste of time.
>
> I understand what you're saying, but I think "inline if" doesn't
> reflect what it's doing and IIF is still not memnonic.
It ultimately from (don't laugh) VB's version of the ternary
operator--called "iif." It is not semantically exactly the same, but it is
"similar" in the C++ inlining sense. For better or for worse, that is its
name.
> > If you used (?) instead, it would absolutely force you to use (?) to
> > complete the ternary conditional. The point of using it somehow, is to
> > enforce that it isn't this: (aaaaaaaaaaaaaa) <= 0x1234 -- if I don't
use
> > it, I can't tell the difference between '?', '!', and 'aaaaaa'.
>
> Yes, but that would force inversion of the conditional, which would
> look weird.
Inversion? You'd just have to swap the 1 and 0: "expr ? 0 : 1" versus
"expr ? 1 : 0".
> > The PP lib uses no other libraries. It won't even use this one. This
is
> > primarily because the concerns are different in the PP-lib. The bugs in
> > VC++ and Metrowerks are ones that break encapsulation. The resulting
fix is
> > to implement the workarounds over the entire library has a whole. The
> > aren't specific enough to localize that cleanly. I also consider the PP
lib
> > to pontentially be *the* base-level library on a library dependency
scale.
> > I like reuse, but only if it is "downward" reuse. I.e. The preprocessor
lib
> > doesn't use the MPL, but the MPL uses the preprocessor lib; the MPL
doesn't
> > use library X, but library X uses the MPL. I think this reuse ordering
> > models the phases of translation (including runtime).
>
> I have no problem with it, but I'd like to hear at least one more
> opinion (other than Gennaro's) before we move forward with it. This
> macro will be used in every Boost library, so if people find it
> terribly odious it will be a failure.
I'm not asserting that it should be done this way. Rather, I'm just
saying that this (or something similar) is possible if that is what you
want.
It seems like a total overkill to me. The benefit does not pay for the
implied complexity. On the plus side, it is clever ;) and yields a clean
syntax. However, I still think that the use of the pp-lib is fine and
represents an acceptable dependency, but in this particular case, it's
overdoing it--IMHO.
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk