|
Boost : |
From: Brian McNamara (lorgon_at_[hidden])
Date: 2003-07-15 18:38:44
I have posted the first "boostified" version of FC++ to the YahooGroups
files section; it is called "fcpp".
http://groups.yahoo.com/group/boost/files/
----------
Background
----------
FC++ is a library for functional programming. In FC++ we program with
"functoids" (classes which define operator() and obey certain other
conventions). The library features include:
- higher order, polymorphic (template) functions (direct functoids)
- lazy lists
- library of useful functions, combinators, and monads (mostly
mimicking the Standard Library of the language Haskell)
- currying
- infix function syntax
- dynamically bound functions (indirect functoids)
- effect combinators
- interfaces to STL via iterators
- ways to transform normal C++ functions/methods into functoids
- a lambda sublanguage, with syntax for lambda, let, letrec,
do-notation, and monad comprehensions
Much of the documentation for FC++ can be found at
http://www.cc.gatech.edu/~yannis/fc++/
and the rest appears linked from
http://www.cc.gatech.edu/~yannis/fc++/New1.5/
(which has a pre-release of the upcoming version (v1.5), currently out
for beta-testing). The upcoming release comprises about 9000 lines of
code and compiles on a number of different compilers (g++, Comeau,
Intel, MSVC++).
Note that all the documentation on our web site uses "FC++" identifiers
rather than "Boost FC++" identifiers. (See below.)
-----------
Boostifying
-----------
I have asked a few questions on the boost mailing list about what would
need to be done to FC++ to "boostify" it. I received a number of useful
comments. Here are the things that have changed from "FC++" to the
submission I just posted to the YahooGroups page (I shall henceforth
refer to that submission as "Boost FC++"):
- Changed naming convention of all types/objects/functions in the
public interface to conform with Boost naming conventions.
(e.g. "enumFrom" is now "enum_from"; "EnumFrom" is "enum_from_type".)
- Reused boost libraries as appropriate. Specifically, I have reused
these items from boost:
- shared_ptr - addressof
- intrusive_ptr - noncopyable
- is_base_and_derived - type_with_alignment
- is_convertible - alignment_of
(I compiled against boost_1_30_0.) I should probably also reuse some
of "mpl", but I have not yet studied that library enough to use it.
- Changed file names so that headers have .hpp file extensions, and
clients have .cpp extensions.
- Moved library into namespace boost (::boost::fcpp).
- Boost FC++ "full functoids" meet the demands of the proposed
"result_of" template, for forward compatibility with boost/std
library "template adaptables".
- The code posted to YahooGroups has been tested on g++-3.1.1 for Solaris
and on icc7 for linux. Prior versions of FC++ have also been tested
on Comeau and VC++7.1. I expect that this code should be reasonably
portable.
-----------------
Known future work
-----------------
There are still a few issues which need tending to which I am aware of.
They are:
- Documentation. There are a number of research papers and tutorials
about FC++ on our web site (mentioned in the Background section,
above). However there is not yet good documentation for Boost
FC++. I need to create a document which (1) describes everything in
one place, (2) is aimed at a C++ audience, and (3) uses the new
Boost FC++ identifiers. Additionally there will need to be a bit of
documentation describing how Boost FC++ relates to the rest of Boost
(especially "lambda", "bind", and "function").
- The header files define objects (in an unnamed namespace) by default.
(Read about FCPP_DEFER_DEFINITIONS at
http://www.cc.gatech.edu/~yannis/fc++/FC++.1.4/changes.html
for a short description.) I am not sure if this behavior is
objectionable or not. Ask me more if you're confused.
- There is probably a way to adapt some functoids which work on
boost::fcpp::list objects so that they can read arbitrary containers
(really, iterator ranges). I should add a little more support for
using Boost FC++ functoids on std:: data structures.
- Copyright notices. The header files contain the FC++ copyright
notice; the clients (.cpp) contain none. I've heard a bit about a
standard Boost license being developed; perhaps by the time (if/when)
FC++ gets added, that will be complete. In any case, the boost
copyright/licensing issues as I understand them are all acceptable to
Yannis and me (the FC++ authors).
----------
Refinement
----------
FC++ is a big library and I expect there will be a number of things
needing refinement to make FC++ acceptable to Boost. I hope this
message will start that discussion.
Thanks,
Brian
-- -Brian McNamara (lorgon_at_[hidden])
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk