|
Boost Users : |
Subject: Re: [Boost-users] [proto] problem with templated recursive transform
From: Eric Niebler (eric_at_[hidden])
Date: 2009-02-07 13:06:03
Daniel Oberhoff wrote:
> Eric Niebler wrote:
>> I've experimented with a variadic Proto. It's not without its problems.
<snip>
> ah, ok, bummer. A friend of mine recently mused if it wasn't time for a
> new language. not like python, more like D. Not that I particularly like
> D (well, I don't really know it either), just that it seems people have
> taken c++ to it's limits, and c++0x can't really help totally, because
> it is an incremental change (even though auto will be great I think, as
> will variadic function templates and move semantics). I opposed him at
> the time, but seeing how much black magic goes into ETs (or DSELs in
> general), he might be right after all.
If programming language evolution stopped at C++, I would be shocked and
disappointed. That said, I don't think C++ has been taken to its limits.
I'm curious to see what the next generation of C++ programmers will do
with new features like concepts, variadics and rvalue references.
If you're sweating the black magic that goes into building a DSELs, then
I suggest you don't think so hard about how the sausage is made. ;-)
>> I've filed bugs against msvc for its mishandling of nested function
>> types. In the mean time, please continue using callable transforms if
>> you like them. You can always wrap them in proto::call<> (or, for object
>> transforms, proto::make<>) to keep msvc happy, if that's a compiler you
>> care about.
>
> Ok, that isn't the worst of solutions, if I end up needing msvc (which
> may actually be the case soon, as we may be required to write plugins
> for windows programs with this stuff...).
You can get pretty far with preprocessor hacks to hide the msvc
workarounds. Here's something to get your gears turning:
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#define _value(x) call<proto::_value(x)>
#endif
Now, if proto::_value(proto::_left) shows up in your grammar, it gets
turned into proto::call<proto::_value(proto::_left)>. I use this trick a
lot.
> Thanks again for taking the time and giving something like proto to the
> community.
My pleasure. I'm glad to see folks starting to use it.
-- Eric Niebler BoostPro Computing http://www.boostpro.com
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