Boost logo

Boost :

Subject: Re: [boost] [local] Help for the Alternatives section
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-03-28 02:08:12


On Monday, March 28, 2011 08:55:45 AM Gordon Woodhull wrote:
>
> On Mar 28, 2011, at 1:44 AM, Thomas Heller wrote:
> > On Monday, March 28, 2011 04:51:42 AM Lorenzo Caminiti wrote:
> >> On Sun, Mar 27, 2011 at 11:20 AM, Thomas Heller
> >> <thom.heller_at_[hidden]> wrote:
> >>> On Sunday, March 27, 2011 05:38:23 PM Lorenzo Caminiti wrote:If you
suggest a text different than "Program body using C++ syntax" I am
> >>>> happy to consider changing the title of the row but I think the row
itself
> >>>> should remain there.
> >>>>
> >>>> This row indicates if the "function" body is programmed using the C++
> >>>> syntax that programmers normally use to program C++ function bodies
> >>>> (and not other C++ constructs).
> >>>
> >>> Well, still misleading. It doesn't make it invalid or "unusual" C++
syntax.
> >>>
> >>> We had this discussion before ... It is valid and legal C++. Both in
syntax
> > and
> >>> semantic.
> >>> The difference is that you need some extra function calls, pay attention
to
> > some
> >>> oddities etc. with phoenix and lambda. But it stays valid C++ syntax.
> >>
> >> Yes, of course it's all valid C++ since it compiles. I can also add
> >> that to the footnote.
> >
> > Maybe "Program body using regular C++ statements" is better suited.
>
> That's what came to my mind too - it's statement syntax versus expression
syntax, right? Phoenix has pseudo-statements but they're still in expression
syntax.

Yes. This is a bit confusing: Everything in Phoenix (or BLL) is a C++ Expression
(having a return type etc., can be void). Phoenix has a statement module, which
emulates C++ statements. As a C++ Expression they have a return type of void.
We compose these expressions using expression templates (woohoo!), which we
traverse upon evaluation.
Phoenix also has something similar to Boost.Local. Not really local functions
but you can adapt (almost) any function object (with everything written with C++
statements) to be phoenix statements.
So i might even claim that you can write phoenix functions "using usual C++
syntax". At the very least you could also use functions defined with Boost.Local
inside phoenix ...

> Fun stuff,

indeed :)

> Gordon


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