$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r68600 - in sandbox/SOC/2010/phoenix3: boost/phoenix/operator boost/phoenix/scope boost/phoenix/scope/detail libs/phoenix/test/scope
From: thom.heller_at_[hidden]
Date: 2011-02-01 08:33:27
Author: theller
Date: 2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
New Revision: 68600
URL: http://svn.boost.org/trac/boost/changeset/68600
Log:
optimized compile times for local variable lookup
Added:
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/local_var_def.hpp   (contents, props changed)
Text files modified: 
   sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp            |     4                                         
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/let_local_gen.hpp |     8                                         
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp   |    66 +++---                                  
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp               |    75 +++----                                 
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp                  |    43 +--                                     
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp       |   393 ++++++++------------------------------- 
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp     |     4                                         
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp        |     4                                         
   8 files changed, 186 insertions(+), 411 deletions(-)
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp	(original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -47,6 +47,8 @@
 #pragma wave option(preserve: 1)
 #endif
 
+#include <boost/phoenix/operator/detail/define_operator.hpp>
+
 namespace boost { namespace phoenix
 {
     PHOENIX_BINARY_OPERATORS(
@@ -125,6 +127,8 @@
     {};
 }}
 
+#include <boost/phoenix/operator/detail/undef_operator.hpp>
+
 #if defined(__WAVE__) && defined(PHOENIX_CREATE_PREPROCESSED_FILES)
 #pragma wave option(output: null)
 #endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/let_local_gen.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/let_local_gen.hpp	(original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/let_local_gen.hpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -1,5 +1,5 @@
 
-#if !defined(PHOENIX_DONT_USE_PREPROCESSED_FILES)
+/*#if !defined(PHOENIX_DONT_USE_PREPROCESSED_FILES)
 #ifndef PHOENIX_SCOPE_DETAIL_LET_LOCAL_GEN_HPP
 #define PHOENIX_SCOPE_DETAIL_LET_LOCAL_GEN_HPP
 
@@ -8,7 +8,7 @@
 #include <boost/phoenix/scope/detail/preprocessed/let_local_gen.hpp>
 
 #endif
-#else
+#else*/
 
 #if !PHOENIX_IS_ITERATING
 
@@ -34,7 +34,7 @@
 #endif
 
 #define PHOENIX_ITERATION_PARAMS                                                \
-    (3, (2, PHOENIX_LOCAL_LIMIT,                                                \
+    (3, (1, PHOENIX_LOCAL_LIMIT,                                                \
     <boost/phoenix/scope/detail/let_local_gen.hpp>))
 #include PHOENIX_ITERATE()
 
@@ -57,4 +57,4 @@
 
 #endif
 
-#endif // PHOENIX_DONT_USE_PREPROCESSED_FILES
+//#endif // PHOENIX_DONT_USE_PREPROCESSED_FILES
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/local_var_def.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/local_var_def.hpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -0,0 +1,117 @@
+
+#if !PHOENIX_IS_ITERATING
+
+/*==============================================================================
+    Copyright (c) 2005-2010 Joel de Guzman
+    Copyright (c) 2010 Thomas Heller
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#ifndef PHOENIX_SCOPE_LOCAL_VAR_DEF_HPP
+#define PHOENIX_SCOPE_LOCAL_VAR_DEF_HPP
+
+#include <boost/phoenix/support/iterate.hpp>
+
+#define M0(Z, N, D) \
+    fusion::pair<BOOST_PP_CAT(Tag, N), BOOST_PP_CAT(A, N)>
+
+#define M1(Z, N, D) \
+    fusion::pair<BOOST_PP_CAT(Tag, N), typename evaluator::impl<BOOST_PP_CAT(A, N) const &, Context const &, int>::result_type >
+
+#define M2(Z, N, D) \
+                typedef  \
+                        fusion::pair< \
+                            BOOST_PP_CAT(Tag, N) \
+                          , typename evaluator::impl<BOOST_PP_CAT(A, N) const &, Context const &, int>::result_type \
+                        > \
+                        BOOST_PP_CAT(pair, N);
+#define M3(Z, N, D) \
+    BOOST_PP_CAT(pair, N)(eval(fusion::at_key<BOOST_PP_CAT(Tag, N)>(locals), ctx))
+
+        template <typename Tag0, typename A0, typename Context>
+        struct local_var_def_is_nullary<
+            fusion::map<
+                fusion::pair<Tag0, A0>
+            >
+          , Context
+        >
+            : evaluator::impl<A0 const &, Context, int>::result_type
+        {};
+
+#define PHOENIX_ITERATION_PARAMS                                                \
+    (4, (2, PHOENIX_LOCAL_LIMIT,                                                \
+    <boost/phoenix/scope/detail/local_var_def.hpp>, 1))
+#include PHOENIX_ITERATE()
+
+
+        struct local_var_def_eval
+        {
+            template <typename Sig>
+            struct result;
+#define PHOENIX_ITERATION_PARAMS                                                \
+    (4, (1, PHOENIX_LOCAL_LIMIT,                                                \
+    <boost/phoenix/scope/detail/local_var_def.hpp>, 2))
+#include PHOENIX_ITERATE()
+
+        };
+
+#undef M0
+#undef M1
+#undef M2
+#undef M3
+
+#endif
+
+#else
+
+#if BOOST_PP_ITERATION_FLAGS() == 1
+        template <BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag), PHOENIX_typename_A, typename Context>
+        struct local_var_def_is_nullary<
+            fusion::map<
+                BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _)
+            >
+          , Context
+        >
+            : mpl::and_<
+                typename evaluator::impl<BOOST_PP_CAT(A, BOOST_PP_DEC(PHOENIX_ITERATION)) const &, Context, int>::result_type
+              , local_var_def_is_nullary<fusion::map<BOOST_PP_ENUM(BOOST_PP_DEC(PHOENIX_ITERATION), M0, _)>, Context>
+            >
+        {};
+
+#endif
+            
+#if BOOST_PP_ITERATION_FLAGS() == 2
+            template <typename This, BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag), PHOENIX_typename_A, typename Context>
+            struct result<
+                This(
+                    fusion::map<
+                        BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _)
+                    > const &
+                  , Context const &
+                )
+            >
+            {
+                typedef
+                    fusion::map<
+                        BOOST_PP_ENUM(PHOENIX_ITERATION, M1, _)
+                    >
+                    type;
+            };
+            
+            template <BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag), PHOENIX_typename_A, typename Context>
+            typename result<local_var_def_eval(fusion::map<BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _) > const &, Context const &)>::type
+            operator()(fusion::map<BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _) > const & locals, Context const & ctx) const
+            {
+                BOOST_PP_REPEAT(PHOENIX_ITERATION, M2, _)
+
+                return
+                    typename result<
+                        local_var_def_eval(fusion::map<BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _) > const&, Context const&)
+                    >::type(
+                        BOOST_PP_ENUM(PHOENIX_ITERATION, M3, _)
+                    );
+            }
+#endif
+
+#endif
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp	(original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -1,4 +1,5 @@
 
+/*
 #if !defined(PHOENIX_DONT_USE_PREPROCESSED_FILES)
 #ifndef PHOENIX_SCOPE_DETAIL_MAKE_LOCALS_HPP
 #define PHOENIX_SCOPE_DETAIL_MAKE_LOCALS_HPP
@@ -9,6 +10,7 @@
 
 #endif
 #else
+*/
 
 #if !PHOENIX_IS_ITERATING
 
@@ -33,8 +35,35 @@
 #pragma wave option(preserve: 1)
 #endif
 
+#define PHOENIX_TYPEDEF_LOCAL_TYPES(Z, N, D) \
+            typedef \
+                typename proto::result_of::value< \
+                    typename proto::result_of::child_c< \
+                        typename proto::result_of::child_c< \
+                            BOOST_PP_CAT(A, N) \
+                          , 0 \
+                        >::type \
+                      , 0 \
+                    >::type \
+                >::type \
+                BOOST_PP_CAT(tag_type, N); \
+\
+            typedef \
+                typename proto::result_of::child_c< \
+                    BOOST_PP_CAT(A, N) \
+                  , 1 \
+                >::type \
+                BOOST_PP_CAT(var_type, N);\
+
+#define PHOENIX_TYPEDEF_LOCAL_PAIR_TYPES(Z, N, D) \
+    BOOST_PP_COMMA_IF(N) fusion::pair<BOOST_PP_CAT(tag_type, N), BOOST_PP_CAT(var_type, N)>
+
+#define PHOENIX_CHILD_OF(Z, N, D) \
+    BOOST_PP_COMMA_IF(N) proto::child_c<1>(BOOST_PP_CAT(a, N))
+
+
 #define PHOENIX_ITERATION_PARAMS                                                \
-    (3, (3, PHOENIX_LOCAL_LIMIT,                                                \
+    (3, (1, PHOENIX_LOCAL_LIMIT,                                                \
     <boost/phoenix/scope/detail/make_locals.hpp>))
 #include PHOENIX_ITERATE()
 
@@ -49,42 +78,15 @@
         template <PHOENIX_typename_A>
         struct make_locals<PHOENIX_A>
         {
-            typedef
-                typename make_locals<
-                    BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(PHOENIX_ITERATION), A)
-                >::type const
-                type0;
-
-            typedef
-                typename expression::sequence<
-                    type0
-                  , BOOST_PP_CAT(A, BOOST_PP_DEC(PHOENIX_ITERATION))
-                >::type
-                type;
+            BOOST_PP_REPEAT(PHOENIX_ITERATION, PHOENIX_TYPEDEF_LOCAL_TYPES, _)
+            typedef fusion::map<BOOST_PP_REPEAT(PHOENIX_ITERATION, PHOENIX_TYPEDEF_LOCAL_PAIR_TYPES, _)> type;
 
             static type const make(PHOENIX_A_a)
             {
-                return
-                    expression::sequence<
-                        type0
-                      , BOOST_PP_CAT(A, BOOST_PP_DEC(PHOENIX_ITERATION))
-                    >::make(
-                        make_locals<
-                            BOOST_PP_ENUM_PARAMS(
-                                BOOST_PP_DEC(PHOENIX_ITERATION)
-                              , A
-                            )
-                        >::make(
-                            BOOST_PP_ENUM_PARAMS(
-                                BOOST_PP_DEC(PHOENIX_ITERATION)
-                              , a
-                            )
-                        )
-                      , BOOST_PP_CAT(a, BOOST_PP_DEC(PHOENIX_ITERATION))
-                    );
+                return type(BOOST_PP_REPEAT(PHOENIX_ITERATION, PHOENIX_CHILD_OF, _));
             }
         };
 
 #endif
 
-#endif // PHOENIX_DONT_USE_PREPROCESSED_FILES
+//#endif // PHOENIX_DONT_USE_PREPROCESSED_FILES
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp	(original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -21,7 +21,7 @@
     PHOENIX_DEFINE_EXPRESSION(
         lambda
       , (proto::terminal<proto::_>) // OuterEnv 
-        (rule::local_var_def_list)  // Locals
+        (proto::terminal<proto::_>)  // Locals
         (meta_grammar)              // Lambda
     )
 
@@ -76,7 +76,9 @@
                 actions_type;
 
             typedef
-                typename proto::detail::uncvref<Locals>::type
+                typename proto::detail::uncvref<
+                    typename proto::result_of::value<Locals>::type
+                >::type
                 locals_type;
 
             typedef
@@ -125,7 +127,9 @@
                 actions_type;
 
             typedef
-                typename proto::detail::uncvref<Locals>::type
+                typename proto::detail::uncvref<
+                    typename proto::result_of::value<Locals>::type
+                >::type
                 locals_type;
 
             typedef
@@ -136,14 +140,13 @@
                 scoped_environment<env_type, OuterEnv const, locals_type const>
                 scoped_env_type;
 
-            
             env_type e(env(ctx));
 
             scoped_env_type
                 scoped_env(
                     e
                   , outer_env
-                  , locals
+                  , proto::value(locals)
                 );
 
             typename result_of::context<scoped_env_type, actions_type&>::type
@@ -169,7 +172,7 @@
         : proto::when<
             expression::lambda<
                 proto::terminal<proto::_>
-              , rule::local_var_def_list
+              , proto::terminal<proto::_>
               , meta_grammar
             >
           , evaluator(
@@ -210,7 +213,7 @@
         struct lambda_actor
             : proto::or_<
                 expression::lambda_actor<meta_grammar>
-              , expression::lambda_actor<rule::local_var_def_list, meta_grammar>
+              , expression::lambda_actor<proto::terminal<proto::_>, meta_grammar>
             >
         {};
     }
@@ -224,14 +227,10 @@
             >
           , proto::when<
                 expression::lambda_actor<
-                    rule::local_var_def_list
+                    proto::terminal<proto::_>
                   , meta_grammar
                 >
-              , detail::local_var_def_is_nullary(
-                    proto::_child_c<0>
-                  , _context
-                  , int()
-                )
+              , detail::local_var_def_is_nullary<proto::_value(proto::_child_c<0>), _context>()
             >
         >
     {};
@@ -269,13 +268,15 @@
         struct result<This(Context, Locals, Lambda)>
         {
             typedef
-                typename proto::detail::uncvref<
-                    typename rule::local_var_def_list::impl<
-                        typename proto::detail::uncvref<Locals>::type &
-                      , Context
-                      , int
-                    >::result_type
-                >::type
+                typename 
+                    boost::result_of<
+                        detail::local_var_def_eval(
+                            typename proto::result_of::value<
+                                Locals const &
+                            >::type
+                          , Context const &
+                        )
+                    >::type
                 locals_type;
 
             typedef
@@ -321,20 +322,19 @@
         operator()(Context & ctx, Locals const& locals, Lambda const& lambda) const
         {
             typedef
-                typename proto::detail::uncvref<
-                    typename rule::local_var_def_list::impl<
-                        Locals &
-                      , Context
-                      , int
-                    >::result_type
-                >::type
+                typename 
+                    boost::result_of<
+                        detail::local_var_def_eval(
+                            typename proto::result_of::value<
+                                Locals const &
+                            >::type
+                          , Context &
+                        )
+                    >::type
                 locals_type;
 
-            locals_type l = 
-                   rule::local_var_def_list()(
-                      locals
-                    , ctx
-                    );
+            locals_type l
+                = detail::local_var_def_eval()(proto::value(locals), ctx);
 
             typedef
                 typename proto::detail::uncvref<
@@ -358,7 +358,7 @@
             >
           , proto::when<
                 expression::lambda_actor<
-                    rule::local_var_def_list
+                    proto::terminal<proto::_>
                   , meta_grammar
                 >
               , lambda_actor_eval(_context, proto::_child_c<0>, proto::_child_c<1>)
@@ -409,13 +409,6 @@
             return lambda_actor_gen<>();
         }
 
-        template <typename Expr0>
-        lambda_actor_gen<Expr0> const
-        operator()(Expr0 const& expr0) const
-        {
-            return expr0;
-        }
-
     #define PHOENIX_LAMBDA_LOCAL_GEN(Z, N, DATA)                                \
         template <PHOENIX_typename_A(N)>                                        \
         lambda_actor_gen<                                                       \
@@ -426,7 +419,7 @@
             return detail::make_locals<PHOENIX_A(N)>::make(PHOENIX_a(N));       \
         }                                                                       \
     /**/
-        BOOST_PP_REPEAT_FROM_TO(2, PHOENIX_LOCAL_LIMIT, PHOENIX_LAMBDA_LOCAL_GEN, _)
+        BOOST_PP_REPEAT_FROM_TO(1, PHOENIX_LOCAL_LIMIT, PHOENIX_LAMBDA_LOCAL_GEN, _)
 
     };
 
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp	(original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -10,6 +10,7 @@
 #define PHOENIX_SCOPE_LET_HPP
 
 #include <boost/phoenix/core/limits.hpp>
+#include <boost/fusion/algorithm/transformation/transform.hpp>
 #include <boost/phoenix/core/expression.hpp>
 #include <boost/phoenix/core/meta_grammar.hpp>
 #include <boost/phoenix/scope/scoped_environment.hpp>
@@ -20,7 +21,7 @@
 {
     PHOENIX_DEFINE_EXPRESSION(
         let
-      , (rule::local_var_def_list)
+      , (proto::terminal<proto::_>)
         (meta_grammar)
     )
 
@@ -39,14 +40,15 @@
                 actions_type;
 
             typedef
-                typename proto::detail::uncvref<
-                    typename boost::result_of<
-                        rule::local_var_def_list(
-                            Locals const &
-                          , Context
+                typename 
+                    boost::result_of<
+                        detail::local_var_def_eval(
+                            typename proto::result_of::value<
+                                Locals const &
+                            >::type
+                          , Context const &
                         )
                     >::type
-                >::type
                 locals_type;
 
             typedef
@@ -82,23 +84,21 @@
                 actions_type;
 
             typedef
-                typename proto::detail::uncvref<
-                    typename boost::result_of<
-                        rule::local_var_def_list(
-                            Locals &
+                typename 
+                    boost::result_of<
+                        detail::local_var_def_eval(
+                            typename proto::result_of::value<
+                                Locals const &
+                            >::type
                           , Context &
                         )
                     >::type
-                >::type
                 locals_type;
             
             typedef scoped_environment<env_type, env_type, locals_type> scoped_env_type;
 
-            locals_type l = 
-                   rule::local_var_def_list()(
-                      locals
-                    , ctx
-                    );
+            locals_type l
+                = detail::local_var_def_eval()(proto::value(locals), ctx);
 
 
             scoped_env_type
@@ -165,13 +165,6 @@
             return let_actor_gen<>();
         }
 
-        template <typename Expr0>
-        let_actor_gen<Expr0> const
-        operator()(Expr0 const& expr0) const
-        {
-            return expr0;
-        }
-
         #include <boost/phoenix/scope/detail/let_local_gen.hpp>
     };
 
@@ -181,7 +174,7 @@
     struct is_nullary::when<rule::let, Dummy>
         : proto::make<
             mpl::and_<
-                detail::local_var_def_is_nullary(proto::_child_c<0>, _context, int())
+                detail::local_var_def_is_nullary<proto::_value(proto::_child_c<0>), _context>()
               , evaluator(
                     proto::_child_c<1>
                   , fusion::vector2<
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp	(original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -9,6 +9,8 @@
 #define PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
 
 #include <boost/phoenix/core/limits.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/container/generation/make_map.hpp>
 #include <boost/phoenix/core/expression.hpp>
 #include <boost/phoenix/core/reference.hpp>
 #include <boost/phoenix/core/value.hpp>
@@ -52,115 +54,6 @@
         struct local_var_def
             : proto::assign<local_variable, meta_grammar>
         {};
-
-        struct local_eval
-            : proto::callable
-        {
-            template <typename Sig>
-            struct result;
-
-            template <typename This, typename Expr, typename Context>
-            struct result<This(Expr&, Context)>
-                : result<This(Expr&, Context const&)>
-            {};
-
-            template <typename This, typename Expr, typename Context>
-            struct result<This(Expr&, Context &)>
-            {
-                typedef 
-                    typename evaluator::impl<Expr const &, Context &, int>::result_type
-                    result_type;
-                typedef
-                    typename mpl::eval_if<
-                        is_reference<result_type>
-                      , expression::reference<
-                            typename boost::remove_reference<result_type>::type
-                        >
-                      , expression::value<result_type>
-                    >::type
-                    type;
-            };
-
-            template <typename Expr, typename Context>
-            typename result<local_eval(Expr const&, Context&)>::type
-            operator()(Expr const& expr, Context & ctx) const
-            {
-                typedef
-                    typename result<local_eval(Expr const&, Context&)>::result_type
-                    result_type;
-
-                return
-                    this->make(
-                        expr
-                      , ctx
-                      , typename is_reference<result_type>::type()
-                    );
-            }
-
-            private:
-                template <typename Expr, typename Context>
-                typename result<local_eval(Expr const&, Context&)>::type
-                make(Expr const& expr, Context & ctx, mpl::true_) const
-                {
-                    typedef
-                        typename remove_reference<
-                            typename result<
-                                local_eval(Expr const&, Context&)
-                            >::result_type
-                        >::type
-                        result_type;
-                
-                    return
-                        this->make_ref(
-                            expr
-                          , ctx
-                          , typename is_const<result_type>::type()
-                        );
-                }
-                
-                template <typename Expr, typename Context>
-                typename result<local_eval(Expr const&, Context&)>::type
-                make_ref(Expr const& expr, Context & ctx, mpl::true_) const
-                {
-                    return phoenix::cref(eval(expr, ctx));
-                }
-                
-                template <typename Expr, typename Context>
-                typename result<local_eval(Expr const&, Context&)>::type
-                make_ref(Expr const& expr, Context & ctx, mpl::false_) const
-                {
-                    //std::cout << typeid(ctx).name() << "\n";
-                    return phoenix::ref(eval(expr, ctx));
-                }
-                
-                template <typename Expr, typename Context>
-                typename result<local_eval(Expr const&, Context&)>::type
-                make(Expr const& expr, Context & ctx, mpl::false_) const
-                {
-                    return phoenix::val(eval(expr, ctx));
-                }
-
-        };
-
-        struct local_var_def_list
-            : proto::or_<
-                proto::when<
-                    proto::comma<local_var_def_list, local_var_def>
-                  , proto::_make_comma(
-                        local_var_def_list(proto::_left , proto::_state)
-                      , local_var_def_list(proto::_right, proto::_state)
-                    )
-                >
-              , proto::when<
-                    local_var_def
-                  , proto::_make_assign(
-                        proto::_left
-                      , local_eval(proto::_right, proto::_state)
-                    )
-                >
-              , proto::terminal<mpl::void_>
-            >
-        {};
     }
 
     template <typename Dummy>
@@ -178,40 +71,13 @@
 
     namespace detail
     {
-        struct local_var_def_is_nullary
-            : proto::or_<
-                proto::when<
-                    proto::comma<
-                        detail::local_var_def_is_nullary
-                      , rule::local_var_def
-                    >
-                  , mpl::and_<
-                        detail::local_var_def_is_nullary(proto::_left, proto::_state)
-                      , evaluator(
-                            proto::_right(proto::_right)
-                          , _context(
-                                proto::_
-                              , mpl::true_()
-                              , boost::phoenix::is_nullary()
-                            )
-                          , int()
-                        )
-                    >()
-                >
-              , proto::when<
-                    rule::local_var_def
-                  , evaluator(
-                        proto::_right
-                      , _context(
-                            proto::_
-                          , mpl::true_()
-                          , boost::phoenix::is_nullary()
-                        )
-                      , int()
-                    )
-                >
-            >
-        {};
+        template <typename Locals, typename Context>
+        struct local_var_def_is_nullary;
+
+
+        struct local_var_def_eval;
+            
+        #include <boost/phoenix/scope/detail/local_var_def.hpp>
         
         struct scope_is_nullary_actions
         {
@@ -235,161 +101,97 @@
                 return t;
             }
         };
-
-        struct find_local
-            : proto::or_<
-                proto::when<
-                    proto::terminal<mpl::void_>
-                  , detail::local_var_not_found()
-                >
-              , proto::when<
-                    proto::comma<find_local, rule::local_var_def>
-                  , proto::if_<
-                        proto::matches<
-                            proto::_left(proto::_right)
-                          , proto::_state
-                        >()
-                      , evaluator(
-                            proto::_right(proto::_right)
-                          , _context
-                        )
-                      , find_local(
-                            proto::_left
-                          , proto::_state
-                        )
-                    >
-                >
-              , proto::when<
-                    rule::local_var_def
-                  , proto::if_<
-                        proto::matches<proto::_left, proto::_state>()
-                      , evaluator(proto::_right, _context)
-                      , detail::local_var_not_found()
-                    >
-                >
-            >
-        {};
-
-        template<typename This, typename Env, typename Key, typename Actions>
-        struct get_local_result_impl
-            : mpl::eval_if<
-                is_same<
-                    typename Env::type::locals_type
-                  , mpl::void_
-                >
-              , typename This:: template result<This(typename Env::type::outer_env_type&, Actions)>
-              , mpl::eval_if<
-                    is_same<
-                        typename proto::detail::uncvref<
-                            typename detail::find_local::impl<
-                                typename Env::type::locals_type &
-                              , Key
-                              , Actions
-                            >::result_type
-                        >::type
-                      , detail::local_var_not_found
-                    >
-                  , typename This:: template result<This(typename Env::type::outer_env_type&, Actions)>
-                  , mpl::identity<
-                        typename detail::find_local::impl<
-                            typename Env::type::locals_type &
-                          , Key
-                          , Actions
-                        >::result_type
-                    >
-                >
-            >
-        {};
-
     }
 
-    template <typename Key>
     struct get_local
     {
         template <typename Sig>
         struct result;
         
-        template <typename This, typename Env, typename Actions>
-        struct result<This(Env, Actions &)>
-            : result<This(Env const &, Actions &)>
+        template <typename This, typename Env, typename OuterEnv, typename Locals, typename Key>
+        struct result<This(scoped_environment<Env, OuterEnv, Locals> const&, Key)>
+            : mpl::eval_if_c<
+                fusion::result_of::has_key<Locals, Key>::type::value
+              , fusion::result_of::at_key<Locals, Key>
+              , result<This(OuterEnv&, Key)>
+            >
         {};
 
-        template <typename This, typename Env, typename Actions>
-        struct result<This(Env &, Actions&)>
+        template <typename This, typename Env, typename OuterEnv, typename Locals, typename Key>
+        struct result<This(scoped_environment<Env, OuterEnv, Locals>&, Key)>
+            : mpl::eval_if_c<
+                fusion::result_of::has_key<Locals, Key>::type::value
+              , fusion::result_of::at_key<Locals, Key>
+              , result<This(OuterEnv&, Key)>
+            >
+        {};
+
+        template <typename This, typename Env, typename OuterEnv, typename Key>
+        struct result<This(scoped_environment<Env, OuterEnv, const mpl::void_> const&, Key)>
+            : result<This(OuterEnv&, Key)>
+        {};
+
+        template <typename This, typename Env, typename OuterEnv, typename Key>
+        struct result<This(scoped_environment<Env, OuterEnv, const mpl::void_>&, Key)>
+            : result<This(OuterEnv&, Key)>
+        {};
+        
+        template <typename This, typename Env, typename Key>
+        struct result<This(Env &, Key)>
         {
-            typedef
-                typename mpl::eval_if<
-                    is_scoped_environment<Env>
-                  , detail::get_local_result_impl<This, proto::detail::uncvref<Env>, Key, Actions&>
-                  , mpl::identity<detail::local_var_not_found>
-                >::type
-                type;
+            typedef detail::local_var_not_found type;
         };
 
-        template <typename Env, typename Actions>
-        typename result<get_local<Key>(Env&, Actions&)>::type
-        operator()(Env &env, Actions &actions) const
-        {
-            return this->evaluate(
-                env
-              , actions
-              , typename is_scoped_environment<Env>::type()
-            );
+        template <typename Env, typename OuterEnv, typename Locals, typename Key>
+        typename result<get_local(scoped_environment<Env, OuterEnv, Locals>&, Key)>::type
+        operator()(scoped_environment<Env, OuterEnv, Locals>& env, Key k) const
+        {
+            return this->evaluate(env, k, typename fusion::result_of::has_key<Locals, Key>::type());
         }
 
-        private:
-            // is a scoped environment
-            template <typename Env, typename Actions>
-            typename result<get_local<Key>(Env&, Actions&)>::type
-            evaluate(Env & env, Actions & actions, mpl::true_) const
-            {
-                return
-                    this->evaluate_scoped(
-                        env
-                      , actions
-                      , typename is_same<
-                            typename proto::detail::uncvref<
-                                typename detail::find_local::impl<
-                                    typename Env::locals_type
-                                  , Key
-                                  , Actions
-                                >::result_type
-                            >::type
-                          , detail::local_var_not_found
-                        >::type()
-                    );
-                    
-            }
+        template <typename Env, typename OuterEnv, typename Locals, typename Key>
+        typename result<get_local(scoped_environment<Env, OuterEnv, Locals>&, Key)>::type
+        operator()(scoped_environment<Env, OuterEnv, Locals> const& env, Key k) const
+        {
+            return this->evaluate(env, k, typename fusion::result_of::has_key<Locals, Key>::type());
+        }
+        
+        template <typename Env, typename OuterEnv, typename Key>
+        typename result<get_local(scoped_environment<Env, OuterEnv, const mpl::void_>&, Key)>::type
+        operator()(scoped_environment<Env, OuterEnv, const mpl::void_>& env, Key k) const
+        {
+            return (*this)(env.outer_env, k);
+        }
+        
+        template <typename Env, typename OuterEnv, typename Key>
+        typename result<get_local(scoped_environment<Env, OuterEnv, const mpl::void_>&, Key)>::type
+        operator()(scoped_environment<Env, OuterEnv, const mpl::void_> const& env, Key k) const
+        {
+            return (*this)(env.outer_env, k);
+        }
 
+        template <typename Env, typename Key>
+        typename result<get_local(Env&, Key)>::type
+        operator()(Env &env, Key k) const
+        {
+            return detail::local_var_not_found();
+        }
+
+        private:
             // is a scoped environment
-            // --> we need to look in the outer environment
-            template <typename Env, typename Actions>
-            typename result<get_local<Key>(Env&, Actions&)>::type
-            evaluate_scoped(Env & env, Actions& actions, mpl::false_) const
-            {
-                Key k;
-                return
-                    detail::find_local()(
-                        env.locals
-                      , k
-                      , actions
-                    );
-            }
-            
-            // is a scoped environment
-            // --> we have the local in our environment
-            template <typename Env, typename Actions>
-            typename result<get_local<Key>(Env&, Actions&)>::type
-            evaluate_scoped(Env & env, Actions &actions, mpl::true_) const
+            template <typename Env, typename Key>
+            typename result<get_local(Env&, Key)>::type
+            evaluate(Env & env, Key, mpl::true_) const
             {
-                return get_local<Key>()(env.outer_env, actions);
+                return fusion::at_key<Key>(env.locals);
             }
             
-            template <typename Env, typename Actions>
-            typename result<get_local<Key>(Env&, Actions &)>::type
-            evaluate(Env &, Actions &, mpl::false_) const
+            // --> we need to look in the outer environment
+            template <typename Env, typename Key>
+            typename result<get_local(Env&, Key)>::type
+            evaluate(Env & env, Key k, mpl::false_) const
             {
-                return detail::local_var_not_found();
+                return (*this)(env.outer_env, k);
             }
 
     };
@@ -401,19 +203,14 @@
         struct result;
 
         template <typename This, typename Local, typename Context>
-        struct result<This(Local &, Context)>
+        struct result<This(Local const &, Context)>
         {
             typedef
-                typename expression::local_variable<Local>::type
-                lookup_grammar;
-
-            typedef get_local<lookup_grammar> get_local_type;
-            typedef
-                typename get_local_type::
+                typename get_local::
                     template result<
-                        get_local_type(
+                        get_local(
                             typename result_of::env<Context>::type
-                          , typename result_of::actions<Context>::type
+                          , Local
                         )
                     >::type
                 type;
@@ -421,12 +218,9 @@
 
         template <typename Local, typename Context>
         typename result<local_var_eval(Local const &, Context&)>::type
-        operator()(Local & local, Context & ctx)
+        operator()(Local const & local, Context & ctx)
         {
-            typedef
-                typename expression::local_variable<Local>::type
-                lookup_grammar;
-            return get_local<lookup_grammar>()(env(ctx), actions(ctx));
+            return get_local()(env(ctx), local);
         }
     };
 
@@ -472,20 +266,7 @@
           , typename Dummy = void
         >
         struct make_locals;
-
-        template <typename A0, typename A1>
-        struct make_locals<A0, A1>
-        {
-            typedef
-                typename expression::sequence<A0, A1>::type
-                type;
-
-            static type const make(A0 a0, A1 a1)
-            {
-                return expression::sequence<A0, A1>::make(a0, a1);
-            }
-        };
-
+        
         #include <boost/phoenix/scope/detail/make_locals.hpp>
     }
 }}
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp	(original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -80,7 +80,7 @@
         int y = lambda[_1]()(x);
         BOOST_TEST(x == y);
     }
-    
+
     {
         int x = 1, y = 10;
         BOOST_TEST(
@@ -183,7 +183,7 @@
     }
 
     {
-        int x = (let(_a = lambda[val(1)])[_a])();
+        int x = (let(_a = lambda[val(1)])[+_a])()();
         BOOST_TEST(x == 1);
     }
 
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp	(original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp	2011-02-01 08:33:25 EST (Tue, 01 Feb 2011)
@@ -50,8 +50,10 @@
                 _a
             ]
             (x) == x
-        );
+        )
+        ;
     }
+
     {
         int x = 1, y = 10;
         BOOST_TEST(