Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2008-07-19 20:14:16


Zeljko Vrba wrote:

>> Again, please define "traditional means".
>>
> Not using fusion.

Huh? Interesting definition :-)

>> What is "rest" and why should fusion cover ML-style pattern matching?
>>
> The "rest" is iterators, views, algorithms, ... actually, anything but
> simple tuples.

Look at it this way: Imagine a world where STL didn't have iterators
and algorithms.

> I did not say that fusion should cover ML-style pattern matching. It was more
> of a curiosity in the lines of "wow, a bunch of stuff besides tuples, and I
> have no idea what to do with it.. is there maybe a pattern-matching facility?
> no.. ok, so what is it good for then?"

STL is still immensely useful. It does not have a pattern-matching facility.
MPL is still immensely useful. It does not have a pattern-matching facility.
I think you are searching the wrong problem domain.

> And I haven't been able to answer the last question to myself. I've browsed
> through the fusion manual, I've tried to find a use for fusion on the project
> that I'm currently working on (mostly algorithmical stuff), and I've failed to
> find where fusion could be useful to me and how it would simplify the program.
>
> So, since I'm unable to find a use for fusion in the stuff I'm working on,
> there are two possible conclusions:
>
> 1. The problem lies in the class of problems I'm working on, so I asked the
> question to find out to which class of problems is fusion suited to.
>
> 2. The problem lies in me, in which case the answer to my question will give
> me a real-life example of other "thinking patterns".
>
>> If anyone can suggest a motivating example and how to improve the
>> docs, I'd appreciate it a lot.
>>
> A random page from the docs:
> http://www.boost.org/doc/libs/1_35_0/libs/fusion/doc/html/fusion/container/set.html
>
> Keys are compile-time types. What is the advantage of set over a simple struct
> having exactly one element of each type? An example of what is easier achieved

Introspection, for one. Can you iterate over the types and data of
an arbitrary struct? No. Genericity, for another. I can write a
generic function (algorithm) that works on *all* fusion maps,
more significantly -all fusion sequences.

> this way (or even just a bunch of e.g. variables on the stack) rather than with
> a struct would be helpful.

YMMV. You can even code in assembler, if you like. It's the abstraction!

> The documentation has artificial examples. Providing some context, e.g. by
> describing a real-world problem which caused the algorithm / function / data
> structure to be added to fusion would be helpful.

This, I agree. It is an area that we need to improve.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

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