[mpl] Fusion/MPL examples
The fusion library manual gives a single example and says "this is just the tip of the iceberg". I was wondering whether the slides/materials from the Boost Conference are available? I'm most interested in the lectures "Boost Metaprogramming Concepts and Frameworks" and "Fusion by example". I'm in the process of (slowly) reading THE "MPL book" (by Dave and Alexei), but I'm looking for more "down-to-earth" examples, rather than constructing small DSLs or creating optimized versions of swap. Synopses of the above lectures contain: "We'll also get a taste of high-level metaprogramming abstractions by using several Boost metaprogramming librariesMPL, Preprocessor, and the Fusion tuple library to solve real problems." "The emphasis for the examples will be on using Boost.Fusion in application code, rather than as infrastructure for library developers." I'm in the process of writing a recursive data structure with very similar operations at every level, but still with small behavioral variations. It seems like a perfect problem for metaprogramming, but I fail to map MPL's type manipulation routines to my down-to-earth problem. I was hoping to get some more insight in MPL from the materials for the abovementioned lectures. Get a new perspective and background to keep in mind while reading the MPL book. So, I kindly ask Dave Abrahams, Dan Marsden and Joel de Guzman to make their lecture materials available on-line, if possible. Thanks and best regards, Zeljko.
on Wed Jun 06 2007, Zeljko Vrba
The fusion library manual gives a single example and says "this is just the tip of the iceberg". I was wondering whether the slides/materials from the Boost Conference are available?
I'm most interested in the lectures "Boost Metaprogramming Concepts and Frameworks" and "Fusion by example".
I'm in the process of (slowly) reading THE "MPL book" (by Dave and Alexei), but I'm looking for more "down-to-earth" examples, rather than constructing small DSLs or creating optimized versions of swap.
By "down-to-earth" I suppose you mean "like the problem I'm trying to solve?"
Synopses of the above lectures contain:
"We'll also get a taste of high-level metaprogramming abstractions by using several Boost metaprogramming librariesMPL, Preprocessor, and the Fusion tuple library to solve real problems."
"The emphasis for the examples will be on using Boost.Fusion in application code, rather than as infrastructure for library developers."
I'm in the process of writing a recursive data structure with very similar operations at every level, but still with small behavioral variations. It seems like a perfect problem for metaprogramming,
Why?
but I fail to map MPL's type manipulation routines to my down-to-earth problem.
Maybe because that's not the most appropriate approach for your problem. Did you go through the book's criteria for when metaprogramming might apply, in section 1.1.6? I have been working on something that sounds similar to what you're doing, but I'm using basic generic programming to do it. Have you seen http://lafstern.org/matt/segmented.pdf ?
I was hoping to get some more insight in MPL from the materials for the abovementioned lectures. Get a new perspective and background to keep in mind while reading the MPL book.
So, I kindly ask Dave Abrahams, Dan Marsden and Joel de Guzman to make their lecture materials available on-line, if possible.
Most of what is in the slides is also in the book, so I don't think it would be of much help to you. If you're not specifically trying to raise the abstraction level of your client's code to the point where they can be seen to be using a DSEL, you probably don't want metaprogramming except as an occasional implementation tool (as shown in the book's swap example, which is really just there to illustrate the value of type information and get you acquainted with type traits). -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Zeljko, may be you can be more specific about your task and we can help you or make some suggestions how to implement it or if metaprogramming will suite to solve the problem. With Kind Regards, Ovanes Markarian On Wed, June 6, 2007 16:52, David Abrahams wrote:
on Wed Jun 06 2007, Zeljko Vrba
wrote: The fusion library manual gives a single example and says "this is just the tip of the iceberg". I was wondering whether the slides/materials from the Boost Conference are available?
I'm most interested in the lectures "Boost Metaprogramming Concepts and Frameworks" and "Fusion by example".
I'm in the process of (slowly) reading THE "MPL book" (by Dave and Alexei), but I'm looking for more "down-to-earth" examples, rather than constructing small DSLs or creating optimized versions of swap.
By "down-to-earth" I suppose you mean "like the problem I'm trying to solve?"
Synopses of the above lectures contain:
"We'll also get a taste of high-level metaprogramming abstractions by using several Boost metaprogramming librariesMPL, Preprocessor, and the Fusion tuple library to solve real problems."
"The emphasis for the examples will be on using Boost.Fusion in application code, rather than as infrastructure for library developers."
I'm in the process of writing a recursive data structure with very similar operations at every level, but still with small behavioral variations. It seems like a perfect problem for metaprogramming,
Why?
but I fail to map MPL's type manipulation routines to my down-to-earth problem.
Maybe because that's not the most appropriate approach for your problem. Did you go through the book's criteria for when metaprogramming might apply, in section 1.1.6?
I have been working on something that sounds similar to what you're doing, but I'm using basic generic programming to do it. Have you seen http://lafstern.org/matt/segmented.pdf ?
I was hoping to get some more insight in MPL from the materials for the abovementioned lectures. Get a new perspective and background to keep in mind while reading the MPL book.
So, I kindly ask Dave Abrahams, Dan Marsden and Joel de Guzman to make their lecture materials available on-line, if possible.
Most of what is in the slides is also in the book, so I don't think it would be of much help to you. If you're not specifically trying to raise the abstraction level of your client's code to the point where they can be seen to be using a DSEL, you probably don't want metaprogramming except as an occasional implementation tool (as shown in the book's swap example, which is really just there to illustrate the value of type information and get you acquainted with type traits).
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Wed, Jun 06, 2007 at 10:52:28AM -0400, David Abrahams wrote:
By "down-to-earth" I suppose you mean "like the problem I'm trying to solve?"
No. I mean examples other than implementing DSLs. I can compare it to the first time I learned about pointers from Wirth's Pascal book: he introduces pointers, shows how to allocate a variable on the heap and how to access it, but.. I kept wondering about what pointers are *useful* for all the way until the example with a linked list. [I was _very_ young then, so I have also wondered about what the linked list was good for, but.. :)]
I'm in the process of writing a recursive data structure with very similar operations at every level, but still with small behavioral variations. It seems like a perfect problem for metaprogramming,
Why?
Hm, good question. I might be prejudicing the solution. Because I have a recursive algorithm and data structure that I'd like to "unroll" at compile-time.
Maybe because that's not the most appropriate approach for your problem. Did you go through the book's criteria for when metaprogramming might apply, in section 1.1.6?
Yes. So, to summarize the questions 1-5: 1. Abstractions of the problem domain: there is no 'domain'. It's a single specialized data structure and associated code (hierarchical scheduler). The scheduling algorithm is the same at each level in the hierarchy (+ a special case at the root). 2. No large amounts of boilerplate code. Just (almost) duplicated code for three (almost) identical classes. 3. I don't need to choose component implementations. 4. Yes, I do want strong type-checking and behavioral customization (different data structures in scheduler nodes). 5. Yes, I want to do it all in C++.
I have been working on something that sounds similar to what you're doing, but I'm using basic generic programming to do it. Have you seen http://lafstern.org/matt/segmented.pdf ?
No, I'll take a look. Thanks. It may also be the case that I'm missing the boundary between generic programming and metaprogramming.
would be of much help to you. If you're not specifically trying to raise the abstraction level of your client's code to the point where they can be seen to be using a DSEL, you probably don't want
No, I'm not trying to do that. I'm trying to refactor the code so that it becomes "manifestly correct" when read together with a high-level description of the algorithm. Best regards, Zeljko.
on Wed Jun 06 2007, Zeljko Vrba
If you're not specifically trying to
raise the abstraction level of your client's code to the point where they can be seen to be using a DSEL, you probably don't want
No, I'm not trying to do that. I'm trying to refactor the code so that it becomes "manifestly correct" when read together with a high-level description of the algorithm.
That sounds exactly like a Generic Programming problem to me. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Zeljko Vrba wrote:
The fusion library manual gives a single example and says "this is just the tip of the iceberg". I was wondering whether the slides/materials from the Boost Conference are available?
I'm most interested in the lectures "Boost Metaprogramming Concepts and Frameworks" and "Fusion by example".
I'm in the process of (slowly) reading THE "MPL book" (by Dave and Alexei), but I'm looking for more "down-to-earth" examples, rather than constructing small DSLs or creating optimized versions of swap. Synopses of the above lectures contain:
"We'll also get a taste of high-level metaprogramming abstractions by using several Boost metaprogramming librariesMPL, Preprocessor, and the Fusion tuple library to solve real problems."
"The emphasis for the examples will be on using Boost.Fusion in application code, rather than as infrastructure for library developers."
I'm in the process of writing a recursive data structure with very similar operations at every level, but still with small behavioral variations. It seems like a perfect problem for metaprogramming, but I fail to map MPL's type manipulation routines to my down-to-earth problem. I was hoping to get some more insight in MPL from the materials for the abovementioned lectures. Get a new perspective and background to keep in mind while reading the MPL book.
So, I kindly ask Dave Abrahams, Dan Marsden and Joel de Guzman to make their lecture materials available on-line, if possible.
The Fusion slides were actually (now loosely) based on an article that Dan and I wrote for Software Developer's Journal (www.sdjournal.org). The arrangement does not limit us from publishing it ourself. Dan and I are contemplating on either: having it somewhere in the web or actually incorporating it in the docs as addendum to the "tip of the iceberg". I'll let Dan speak up as he's been more of the force behind fusion now that I'm concentrating on Spirit2. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
participants (4)
-
David Abrahams
-
Joel de Guzman
-
Ovanes Markarian
-
Zeljko Vrba