Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-02-25 05:07:12


"Brian McNamara" <lorgon_at_[hidden]> wrote
> On Sat, Feb 21, 2004 at 10:19:02AM -0000, Andy Little wrote:

>
> I agree with some of your comments here about FP in the C++ setting.
> Specifically, absolute purity (side-effect freedom) trades away
> assignment and mutable variables in order to buy freedom of evaluation
> order, which can be useful for compiler optimizations, especially in
> parallel settings. Since C++ clearly has effects and assignment (and
> the C++ compiler is not going to employ the same kinds of optimizing
> transforms common in pure languages), purity is not going to be a big
> win here.

In that case is not FC++ rather a grand title for the library? There is a
strong sense in the documentation of attempting to 'hijack' (your word) C++
for your own purposes.IOW you don't actually like C++ much. For example the
lambda library uses the term function-objects rather than functoids. Its a
small difference but significant. You appear to be fighting C++ at every
level from the compiler upwards. You appear to have got things upside down.
It would seem more appropriate to call C++ process to do the dirty work from
within the pure FP, rather than embedding FP in C+. That would be
interesting, and would allow each language to perform at its best.

>
> But there's more to FP than just purity. Higher-order functions,
> lambda, and closures let you write code in a more applicative style,
> which can raise the overall level of abstraction.

Ok I am trying to find where or why I might find this library useful.
Higher order functions are essentially functions that manipulate other
functions? Say to build up an expression from some token, object
sequence either(both) at compile time or(and) at run time according to some
rule. Presumably I am allowed to manipulate objects as well as functions in
FC++.?

As I understand lambda in Context of C++, it is basically an alternative
syntax to writing a function in the traditional (C/C++) sense, and achieves
the above?
FC++ exposes the lambda mechanisms? Deconstructing Lambada would be good :-)

I do not know what closures are.

Raising the level of abstraction seems to be an end in itself. And for
simplicity it requires that all entities conform. The C++ abstraction
mechanisms make allowances for entities that dont conform.That is it can
reach in at a low level. How does FP see non conforming entities.. Are they
an impurity which is banned?

> Features like these
> do "mix well" with C++ or other OOP languages. Indeed, recent OOPLs
> have been including various functional features: for example, Python
> has lambda and list comprehensions, and Scala has lambda as well as
> generalized monadic comprehensions in its "for" statement.

I do not know what 'comprehensions are. . I like (think in terms of )
objects(C++ classes). They play a far more important role in my day to day
programming than functions. but they appear to be anathema to FP. Hence it
seems to be an impoverished language. Its good with the abstractions . but
cant deal very well with 'meat'.

> Functional
> programming is a wide umbrella, and though not all of it mixes well
> with OOP, a number of features do work synergistically between the two
> paradigms.

Ok.. I see the vision. FC++ is ultimately a new language. Maybe its a good
one. I would tend to see the FP part as an overall controlling mechanism,
which managed good old dirty C++ objects. Perhaps the FC++ vision in the
library is not grand enough.

regards
Andy Little


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