[local] couple questions

1) I notice from http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... that (proposed) Boost.Local has a dependency on Boost.ScopeExit. It seems that Boost.Local provides all the functionality of Boost.ScopeExit, and then some; at least, that's what seems to be implied by http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... It would seem reasonable then, maybe, should Boost.Local be accepted, to remove the dependence on Boost.ScopeExit and officially deprecate Boost.ScopeExit in favor of Boost.Local's BOOST_LOCAL_EXIT: http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... What are your (you = Lorenzo or anyone else) thoughts regarding that development path? 2) I haven't read through the docs in *too* much detail yet, but I would guess from, for example, http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... that copying a Boost.Local functor amounts to something less than a deep copy, and possibly an entirely shallow copy. In other words, does int x = 0; void BOOST_LOCAL_FUNCTION_PARAMS( bind(int) x ) { // bind x by value, so a copy is taken... std::cout << ++x << std::endl; } BOOST_LOCAL_FUNCTION_NAME(f) boost::function< void ( ) > g(f); f(); g(); print "1" followed by "2" (my guess), or does it print "1" twice? I may have missed it entirely, but I'd like the semantics of copying a Boost.Local functor explicitly spelled out. P.S.: I noticed in http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... a misspelling in the comments of the last example, s/BOOST_IDENTITY_VALE/BOOST_IDENTITY_VALUE/. - Jeff

On Thu, May 26, 2011 at 6:52 PM, Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung@gmail.com> wrote:
1) I notice from
http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local...
that (proposed) Boost.Local has a dependency on Boost.ScopeExit. It seems that Boost.Local provides all the functionality of Boost.ScopeExit, and then some; at least, that's what seems to be implied by
http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local...
It would seem reasonable then, maybe, should Boost.Local be accepted, to remove the dependence on Boost.ScopeExit and officially deprecate Boost.ScopeExit in favor of Boost.Local's BOOST_LOCAL_EXIT:
http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local...
What are your (you = Lorenzo or anyone else) thoughts regarding that development path?
Yes, it'd make sense to merge Boost.Local and Boost.ScopeExit -- see footnote 17 at http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... I'd think then Alexander Nasonov will participate to Boost.Local review and appear as a Boost.Local co-author.
2) I haven't read through the docs in *too* much detail yet, but I would guess from, for example,
http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local...
that copying a Boost.Local functor amounts to something less than a deep copy, and possibly an entirely shallow copy. In other words, does
The copy is shallow. It essentially copies a couple of function pointers within boost::local::aux::function and the bound variables are all internally hold by reference: http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... However the following example...
int x = 0; void BOOST_LOCAL_FUNCTION_PARAMS( bind(int) x ) { // bind x by value, so a copy is taken... std::cout << ++x << std::endl; } BOOST_LOCAL_FUNCTION_NAME(f)
boost::function< void ( ) > g(f);
f(); g();
print "1" followed by "2" (my guess), or does it print "1" twice? I may
... prints "1" followed by "1" because "x" is bind by value so "x" becomes 2 only within an execution of the local function and not across executions (i.e., x is not threated as a static local variable within the local function). This prints "1" followed by "1" even is you call f(); f(); instead of f(); g(); so it's not because of copying f in g but it's because of the binding by value semantics (which are the same semantics as of Boost.ScopeExit -- but scope exits are always executed just one time). This should be explained here: http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local... And if it's not clear I can explain it better...
have missed it entirely, but I'd like the semantics of copying a Boost.Local functor explicitly spelled out.
Yes, I think I should explain this better maybe in: http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local...
P.S.: I noticed in
http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local...
a misspelling in the comments of the last example, s/BOOST_IDENTITY_VALE/BOOST_IDENTITY_VALUE/.
OK, I'll fix it. Thanks, --Lorenzo
participants (2)
-
Jeffrey Lee Hellrung, Jr.
-
Lorenzo Caminiti