Subject: Re: [boost] Template metaprogramming libraries
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2011-09-10 17:35:16
On Sep 10, 2011, at 7:03 AM, Ãbel Sinkovics <abel_at_[hidden]> wrote:
> Hi Gordon,
> "Nested Lambda Expressions with Let Expressions in C++ Template
> Metaprograms" explains metamonad's lambda expressions.
> The major
> difference between that approach and MPL's lambda expressions is that
> metamonad lambda expressions let the user specify the name of the
> arguments instead of calling them _1, _2, etc.
Wonderful! This would clarify my algos greatly. Seems like it shouldn't be much slower either.
> I'm not aware of techniques based on monads that help implementing
> data-structues. They are good at abstracting behaviours (error handling,
> non-determinism, etc.), they should help you with error propagation in
> your algorithms (see compile-time exceptions in metamonad).
Hmm, I've got plenty to learn about FP. Monad seems to mean a lot of things. Maybe I was only thinking of the kind that wraps real side effects like memory writes.
Anyway this still seems very helpful.
In particular I have been writing the tests without failure cases because a compilation error is not a great expected failure. I look forward to exploring further.
> lazy_eval_if: 3.89 s
> eval_if: 3.65 s
> As you can see, there is some overhead (lazy_eval_if uses eval_if),
> however it may be different with other compilers.
Not too bad. I'd like to know what the penalty for a larger algorithm is - also for the lambdas and exceptions/monad stuff. When I get a chance I may try porting my depth_first_search to your libs to find out.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk