Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-12-16 19:46:34


----- Original Message -----
From: "David Abrahams" <dave_at_[hidden]>

> >> 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."
>
> Ha har hee hee ha har hee hoo hahaha har hee hee ha har hee hoo hahaha
> har hee hee ha har hee hoo haha har hee hee ha har hee hoo hahaha har
> hee hee ha har hee hoo haha har hee hee ha har hee hoo hahaha har hee
> hee ha har hee hoo haha har hee hee ha har hee hoo hahaha!

I've been converted. I swear! "When I was young, I had to walk to school
in three feet of snow uphill both ways--and, worse yet, I had to program in
Visual Basic!" It doesn't get any more "wordy" than this:

Public Function Sum(ByVal X As Long, ByVal Y As Long) As Long
    Sum = X + Y
End Function

vs.

int sum(int x, int y) {
    return x + y;
}

(Actually, I'm not sure if the "Function" above is even right anymore--not
that I care.)

> > It is not semantically exactly the same, but it is "similar" in the
> > C++ inlining sense.
>
> No _way_!
>
> > For better or for worse, that is its name.
>
> Worse ;-)

Too little too late. I actually like the name because it is so short and
roughly describes its purpose.

> > Inversion? You'd just have to swap the 1 and 0: "expr ? 0 : 1" versus
> > "expr ? 1 : 0".
>
> Oh, OK. I don't care, really.

;)

> > 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.
>
> I sympathize with that POV.
>
> > 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.
>
> Yeah, it's kinda heavyweight. Since you and Gennaro agree, I think
> I'll opt out unless someone argues strongly for it.

It *is* the more "fun" way to do it.

Paul Mensonides


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