|
Boost : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2004-03-02 03:44:43
> > > 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.
[...]
> 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.
If I understand you correctly what you are saying is: "let's have it just
because it's cool example of what could be done with C++, good example of
GTM in use".
Well I do not know what to say here, other then it wouldn't be my choice.
Maybe only couple things:
1. FC++ is freely available on the web. Do you want to rake up all the code
written under boost hood?
2. There is nothing cool about class designed and implemented the way so it
works 320 times slower then similar solution written in different style. And
I am not talking about minor issues related to abstraction overhead and
portability workarounds. There should be something wrong in the very heart
of the design, for this to happened.
3. One of the main lessons I brought from numerous examples of GTM is
actually that we need to stay away from FP in our production programming as
far as possible. After all usage of FP techniques it's primary reason why
compilation more and more taking ridiculously long time nowadays. IOW from
where I stand now I wouldn't want my fellow coworkers to start using FP in
our design. If you(anybody) know an example where FP actually does bring any
advantages, please step out. In other case your statement that lazy_list
design/implementation/idea is cool have no grounds.
> > > 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.
My understanding is that there exist already solution in sandbox to
implement support for result_of. And example of PP usage are all over the
place (not mentioning that PP has pretty good docs). If you need more
examples let's then just have new section dedicated to an example of usage
and put some staff there.
> Dave
Gennadiy.
P.S. To make myself clear: I am all for introduction and implementing
support for polymorphic function objects. I just don't buy the whole idea of
FP in runtime (at least yet)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk