|
Boost Users : |
Subject: Re: [Boost-users] [proto] helpful for a compiler project?
From: John Phillips (phillips_at_[hidden])
Date: 2009-01-27 00:06:44
peter_foelsche_at_[hidden] wrote:
> I assume that by "top-posting" you mean that I did not prefix my subject with [proto] -- sorry.
>
Peter - No, that is not what top posting means.
As explained on the web page Eric references, top posting is placing
your reply at the very top of the email, with the message you are
replying to below that. In a detailed technical conversation (which many
Boost conversations are) it makes it very difficult for anyone to keep
track of details. Since details are important in Boost conversations,
the posting policy actively discourages top posting.
> You are condescending.
>
I'm sorry if you felt offended by any post on Boost (Eric's or any
other), but please try to keep the conversation to professional tones
and topics. You will find that typical Boost participants are very
helpful people, but also very busy. It is reasonable to assume that any
comment you consider brisk was not intended that way. It was just the
result of trying to provide a rapid response.
Even if you feel certain someone is behaving badly, maintaining a
useful and constructive tone sets a better example and may help them
become a more effective part of the conversation. The list has a
collection of moderators who step in on the rare occasions anything has
gotten out of hand. (I am not one of the moderators, by the way.)
> I'm just trying to understand this new library to see whether there are any areas of applications for me.
>
> I was already inside these examples.
>
> It sounded pretty much like a compiler-compiler to me.
>
> But I don't see any need to parse Object-Literals-expressions and execute them
> -- isn't there already a lambda library?
>
> Peter
The topics of expression templates and DSELs are fairly large and
involved. A detailed discussion is better found in books on templates,
metaprogramming and related subjects (including the excellent one by
Abrahms and Gurtovy) However, the goals are fairly simple.
Expression templates use the template instantiation mechanism to
produce code that customizes itself during instantiation to be a better
fit to the needs of the problem at compile time. The typical example is
a matrix math library that builds a near optimal algorithm based on the
context of the equation where the matrix math is used. It provides the
dual benefits of clear and expressive code with the potential for highly
optimized performance.
A DSEL is a Domain Specific Embedded Language. A language built to
provide very good abstractions for a specific problem domain, that is a
properly formed subset of some other, general purpose language. This
lets the general purpose language naturally express abstractions and
actions in the specific domain. When C++ is the general purpose
language, designing a DSEL usually involves the template system, and
expression templates. A good example for a DSEL is the Spirit library,
which is also part of Boost. Spirit expresses parsing (and, with Spirit
2, also lexing and generation) in the language of EBNF grammars, but
does so inside properly formed, and portable C++ code.
While lambdas are also a useful tool for constructing DSELs, I think
the makers of Spirit would argue that proto cannot be readily replaced
by them. After all, Spirit uses proto and a lambda library called
Phoenix as components.
If this is enough where you now see the basic idea, I would suggest
you look through proto, as well as Spirit and its other component pieces
and see if you can understand how these tools are working together. They
are very well designed libraries, and your understanding of the power of
C++ will grow by leaps and bounds by studying them. (or, at least, mine did)
I hope you find that a more satisfactory answer.
John
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net