Boost logo

Boost Users :

From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2008-07-20 09:21:34


On Sun, Jul 20, 2008 at 07:39:02PM +0800, Joel de Guzman wrote:
>
> Can't see the connection yet? Don't limit yourself to just thinking in
> terms of tuples. Think in terms of data-structures, sequences, containers,
> views.
>
OK, let's take an example of a CSV parser. Let's say I read the whole CSV
file into an std::vector<F>, where F is some fusion container. So far, so
good. Now I want a view (abstraction) V that will let me treat i'th column
of the dataset as if it were a vector, e.g. V[17] would return me the i'th
column of 17th row, and even allow me to modify it. And then this abstraction
could be passed around, iterated over, used in STL algorithms, etc. It has
the same properties as vector (random access container), except that it's
storage is not contiguous.

Does this look like something that fusion could help with? (Though, for the
record, I would personally not do casual data processing and CSV parsing in
C++; the time spent learning fusion and coding processing functions seems much
more productively spent in learning something like R.)

And no, I don't see the connection. For me, the emperor is naked (see below
about maintainability). Maybe I'm stupid, maybe I'm just not easily
susceptible to latest.. erm. "technologies", until they have proven their value
(again, see below on maintainability to get an idea of my value metrics). Pick
what you like.

>
> Wrong analogy. ML has homogeneous lists, like STL. A list (in ML) is
> essentially a sequence of items but they must be all of the same type.
>
Except that the "same type" can actually be a variant.

> >just "do
> >not seem" useful at compile-time.. at least not when I'm thinking ML where
>
> Are you saying that MPL is not useful too? Out of curiosity,
> have you used MPL?
>
Stop reinterpreting my words to your convenience. I ignored one such previous
case along those lines, but no more. I'm saying exactly what I wrote and what
is quoted above: it does not seem useful. This is not the same as saying that
it is not useful (which, for the record, although it should be obvious, I did
NOT say).

No, I have not used MPL. Yes, I've read the introduction and motivation (the
example with dimensional algebra), and it seems like a rather niche
application. Heck, I've even tried to read the MPL book and the question mark
in my head just got bigger, not smaller. It is a reference book about
manipulating typelists, but it does not say what typelists are good for. I
haven't been able to find a use for MPL myself. From my POV, it's a black
magic used by library writers to provide "nice" library interfaces, and which
spits out hundreds (or megabytes if the user is unlucky) of error messages if
the user does something wrong.

And the basic question remains unanswered for me: How does MPL (or fusion for
that matter) help in making more maintainable code? More maintainable as in:

  - less lines of code
  - code that is easier to understand
  - code that is easier to inspect at runtime with a debugger
  - code that can be modified by a C++ developer who does not know every dark
    corner of the template language
  - code that is written faster (i.e. takes less time to get a successful
    compilation) and works correctly the first time it is written

How are fusion/MPL useful to an *application* programmer, not a library
developer?


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