On 12/8/2010 5:30 PM, Thomas Heller wrote: > I don't really now how to do it otherwise with the current design. > There is really only this part of the puzzle missing. If it is done, we have > a working and clean Phoenix V3. > For the time being, I can live with the workaround I did. > However, I will focus my efforts of the next days on working out a patch for > this to work properly.
I made a simple fix to proto::matches on trunk that should get you moving. The overloads can still be smarter about sub-domains, but for now you can easily work around that by explicitly allowing expressions in sub-domains in your super-domain's grammar. See the attached solution to your original problem. -- Eric Niebler BoostPro Computing http://www.boostpro.com
#include <boost/proto/proto.hpp> namespace mpl = boost::mpl; namespace proto = boost::proto; typedef proto::terminal<int> int_terminal; typedef proto::terminal<double> double_terminal; template <typename Expr> struct actor1; struct domain1; struct grammar1 : proto::or_< proto::plus<grammar1, grammar1> , int_terminal , proto::if_<proto::is_sub_domain_of<proto::domain_of<proto::_>, domain1>()> > {}; struct domain1 : proto::domain< proto::pod_generator<actor1> , grammar1 , proto::default_domain > {}; template <typename Expr> struct actor1 { BOOST_PROTO_BASIC_EXTENDS(Expr, actor1<Expr>, domain1) }; template <typename Expr> struct actor2; struct grammar2 : proto::or_< proto::plus<grammar2, grammar2> , double_terminal > {}; struct domain2 : proto::domain< proto::pod_generator<actor2> , grammar2 , domain1 > {}; template <typename Expr> struct actor2 { BOOST_PROTO_BASIC_EXTENDS(Expr, actor2<Expr>, domain2) }; actor1<int_terminal::type> t1 = {{0}}; actor2<double_terminal::type> t2 = {{0}}; int main() { t1; t1 + t1; t2; t2 + t2; t1 + t2; }
_______________________________________________ proto mailing list proto@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/proto