Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2004-03-02 02:46:29


"Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]> wrote in message
news:35C251B635189944B65CAB923470EA9601FEC5E7_at_execmail.apps.ilx.com...
> [I wrote...]
> > out. I think the sheer difficulty of generic/template/
> > meta-programming should cause us to welcome thorough
> > examples of working libraries, because at the least, they
> > show us what can and can't be done, and serve as a model
> > full of lessons that can be re-used in other contexts.
>
> Let's not mix apples and oranges. C++ type system present
> natural environment for FP techniques, and we bound to use them.
> While submitted library promote FP in runtime environment. And I
> found it difficult to justify to myself need for that without clear
> examples and tests.

I'm actually not referring to the FP-ness of FC++. I'm referring to the
generic/template/meta-ness of FC++. I'm talking about the
syntactical and semantic limitations of C++ which are explored by
libraries like FC++. I'm talking about things like having to wrap
constants to get lazy evaluation, how to express lazy operators, etc.
I'm sure many of the techniques used to *implement* FC++ (or
BLL or Bind or Function or any of the related libraries) have some
general utility in other domains, and those are the lessons to which
I refer. In this sense, I deem it irrelevant that FC++ is a library for
functional programming.

Allow me to elaborate a bit. If you want an example of how to write a
linked list, you can find hundreds of thousands of implementations on
the web. If you want an example of a trie, you won't find quite as many,
but you should still be able to find a good number. If you want to write
a parser generator, the field becomes yet narrower. If you want to
find out how to write robust, idiomatic generic/meta-C++, to where do
you turn? Where are the definitive sources for this type of
programming? I would suggest that the answer to that question is:
Boost. That is not to say that good generic/template/meta-code (can
I just say GTM?) cannot be found elsewhere, because it can. But
I dare say that a good deal of the discussion *about* such code
occurs here. If you want to know how templates work, read Josuttis
& Vandevoorde. But if you want to know how to write GTM code
in the "current style" (if it is even proper to say such a thing), I would
look first in Boost libraries.

Insofar as Boost has become something of an authoritative repository
of "GTM libraries", I think that FC++ has perhaps earned a place
here. I think it probably needs work to become idiomatic in the most
current style, but then, so do probably a lot of libraries.

> > Even just discussing the library helps formalize idioms and
> > practices that maybe some people find obvious, but are not
> > gathered together into any definitive document.
>
> These idioms already formalized pretty good in FP dedicated
> literature.

I'm talking about C++-specific GTM idioms and devices, like
result_of<>, Preprocessor usage, etc. I highly doubt those are
covered by the FP literature. ;) As it happens, I'm sure that there
are many implicit idioms hiding in the GTM code in Boost, but it
takes more usage of the idioms for them to become manifest.
Therefore, having more GTM libraries makes it more clear which
code devices are being reused and thus should be formalized.

Dave

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004

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