From: "Joel de Guzman" <[EMAIL PROTECTED]> > From: "Peter Dimov" <[EMAIL PROTECTED]> > [...] > > ref(x)(...) can mean two different things, both reasonable. One is to simply > > return x. The other is to return x(...). The convention we have adopted so > > far in bind and function is to treat ref as if ref(x)(...) returns x(...). > > This has nothing to do with spirit using bind, function, or lambda. It's > > about the semantics of ref. > > > > In fact, if you use ref(b) as above, you now have no way to express the > > other operation, make if_p store a reference to the function object: > > > > if_p(ref(f)) > > [ > > ] > > > > This is necessary when f has state or cannot be copied. > > Ok, I understand. Anyway, do you have a suggestion? Perhaps > what I need then is a low-fat var(x) and val(x). > > Thoughts?
My thoughts with my "independent observer/low-tolerance library user" hat on are: * A good lambda library should already have a low-fat, low-dependency var(x), something like template<class E> struct basic_lambda_expression {}; // tag template<class T> class var_expression: public basic_lambda_expression< var_expression<T> > { public: typedef T & result_type; // obvious implementation }; * Two good lambda libraries sharing the same boost:: namespace will share basic_lambda_expression<> and recognize each other's lambdas. ;-) _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost