|
Boost : |
From: Greg Colvin (greg_at_[hidden])
Date: 2000-07-23 19:03:28
From: David Abrahams <abrahams_at_[hidden]>
> The template mechanism is equivalent to a functional programming language.
> What is this construct called in Lisp? Ugh, I think it's called 'if'.
The more traditional form is 'cond', but the syntax is a little different.
> What is the ?: operator called in C/C++?
From the standard --
conditional-expression:
logical-or-expression
logical-or-expression ? expression : assignment-expression
> BTW, I attended a Generic Programming conference with C&E in '98
> http://www.cs.rpi.edu/~musser/gp/dagstuhl/gpdag.html where they talked about
> generative programming. Most of it seemed to be a pile of buzzwords and
> excitement with little to back it up, but they did present a complete lisp
> interpreter implemented at compile-time with C++ templates!
Now that's cool. Got a link? Or do I have to get the book?
> From: "Greg Colvin" <greg_at_[hidden]>
> > From: David Abrahams <abrahams_at_[hidden]>
> > > I totally support all of Howard's arguments below :)
> >
> > Me too. But what names to use? Howard's names for 'IF'
> > don't make it so clear what the meaning of the parameters
> > is. Maybe 'If' would do?
> >
> > Or if we are feeling very brave, how about something like
> > #define If whatever<
> > #define Then ,
> > #define Else ,
> > #define End >::type
> > so that instead of the inscrutable
> > typedef If<flag, type1, type2>::type my_type;
> > we can write
> > typedef
> > If flag Then
> > type1
> > Else
> > type2
> > End
> > my_type;
> >
> > And Howard thought he was getting punchy!
No comment, eh?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk