[Bind] Placeholder scope

I have just spent several hours digging out a compile problem which turned out to be a conflict between Boost.Bind and Boost.Lambda, which seems to arise because the Boost.Bind placeholders (_1, etc.) are in the global namespace, so if "using namespace boost::lambda;" is in effect the Bind placeholder is used rather than the Lambda placeholder. I wonder why the Bind placeholders are in the global namespace? Thanks, Rob.

AMDG Robert Jones wrote:
I have just spent several hours digging out a compile problem which turned out to be a conflict between Boost.Bind and Boost.Lambda, which seems to arise because the Boost.Bind placeholders (_1, etc.) are in the global namespace, so if "using namespace boost::lambda;" is in effect the Bind placeholder is used rather than the Lambda placeholder.
I wonder why the Bind placeholders are in the global namespace?
It's an historical artifact which has never been fixed. In Christ, Steven Watanabe

Steven Watanabe wrote:
AMDG
Robert Jones wrote:
I have just spent several hours digging out a compile problem which turned out to be a conflict between Boost.Bind and Boost.Lambda, which seems to arise because the Boost.Bind placeholders (_1, etc.) are in the global namespace, so if "using namespace boost::lambda;" is in effect the Bind placeholder is used rather than the Lambda placeholder.
I wonder why the Bind placeholders are in the global namespace?
It's an historical artifact which has never been fixed.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I suspect all of us have been bitten by this at least once. Would a patch be welcome to resolve it or would it break too many historical artifacts with the change? michael -- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com

Steven Watanabe wrote:
Robert Jones wrote:
I wonder why the Bind placeholders are in the global namespace?
It's an historical artifact which has never been fixed.
Are you implying that it could/should be fixed? I have to admit that I ran into the same problem and silently accepted that bind and lambda don't cooperate well. I somehow thought that phoenix would be the successor of lambda, and would solve all these nasty little gotchas (this one is probably solved by using arg1 instead of _1 as placeholder in phoenix). Regards, Thomas

Thomas Klimpel wrote:
Steven Watanabe wrote:
Robert Jones wrote:
I wonder why the Bind placeholders are in the global namespace?
It's an historical artifact which has never been fixed.
Are you implying that it could/should be fixed?
Well, at least there is a ticket for that: https://svn.boost.org/trac/boost/ticket/2240 FWIW, std::bind has its placeholders in std::placeholders namespace. [snip]
Regards, Thomas
Regards, Gevorg

On Sun, Jun 7, 2009 at 2:09 PM, Gevorg Voskanyan
Thomas Klimpel wrote:
Steven Watanabe wrote:
Robert Jones wrote:
I wonder why the Bind placeholders are in the global namespace?
It's an historical artifact which has never been fixed.
Are you implying that it could/should be fixed?
Well, at least there is a ticket for that: https://svn.boost.org/trac/boost/ticket/2240
FWIW, std::bind has its placeholders in std::placeholders namespace.
I wasn't aware that there was a std::bind - is this in the C++03 standard, or one of the library technical reports? (Any URL to the standard spec would be appreciated) Thanks, Rob.

Robert Jones wrote: [snip]
I wasn't aware that there was a std::bind - is this in the C++03 standard, or one of the library technical reports?
(Any URL to the standard spec would be appreciated)
Thanks, Rob.
It is part of the upcoming standard - C++0x http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2857.pdf Best Regards, Gevorg

2009/6/7 Gevorg Voskanyan
I wasn't aware that there was a std::bind - is this in the C++03 standard, or one of the library technical reports?
(Any URL to the standard spec would be appreciated)
Thanks, Rob.
It is part of the upcoming standard - C++0x
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2857.pdf
It's also a part of tr1. See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf. Roman Perepelitsa.

On Sun, Jun 7, 2009 at 2:09 PM, Gevorg Voskanyan
Thomas Klimpel wrote:
Steven Watanabe wrote:
Robert Jones wrote:
I wonder why the Bind placeholders are in the global namespace?
It's an historical artifact which has never been fixed.
Are you implying that it could/should be fixed?
Well, at least there is a ticket for that: https://svn.boost.org/trac/boost/ticket/2240
FWIW, std::bind has its placeholders in std::placeholders namespace.
and On Sun, Jun 7, 2009 at 6:49 AM, Michael Caisse < boost@objectmodelingdesigns.com> wrote:
I suspect all of us have been bitten by this at least once. Would a patch be welcome to resolve it or would it break too many historical artifacts with the change?
Also cross posting to boost developers. The ticket is owned by Peter D., but does anyone mind if I submit a patch for this? It would be a very breaking change I think. Should the previous behaviour be maintained via an #ifdef, eg #ifdef BOOST_UNSCOPED_PLACEHOLDERS - Rob.
participants (6)
-
Gevorg Voskanyan
-
Michael Caisse
-
Robert Jones
-
Roman Perepelitsa
-
Steven Watanabe
-
Thomas Klimpel