[boost] Boost.Local Review (Nov 10, 2011 to Nov 19, 2011)

Hi all, It is time! The review of Lorenzo Caminiti's proposed Boost.Local library begins tomorrow, ***November 10, 2011***, and ends on ***November 19, 2011***. Boost.Local implements local functions, local blocks, and local exits for the C++ programming language. It allows one to define a function at any declarative scope, including function scope; bind variables from the enclosing scope; and pass this function to templated STL-style algorithms. Please see the Introduction of the documentation for a longer but still brief overview. -------- The code and documentation are available from the Boost sandbox ( https://svn.boost.org/svn/boost/sandbox/): https://svn.boost.org/svn/boost/sandbox/local/ [everything] https://svn.boost.org/svn/boost/sandbox/local/boost/ [code] https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/index.html[documentation] -------- Please state clearly whether you think this library should be accepted as a Boost library. Other questions you may want to consider: - What is your evaluation of the design? - What is your evaluation of the implementation? - What is your evaluation of the documentation? - What is your evaluation of the potential usefulness of the library? - Did you try to use the library? With what compiler? Did you have any problems? - How much effort did you put into your evaluation? A glance? A quick reading? In-depth study? - Are you knowledgeable about the problem domain? Please also consider the following issues and proposals specific to Boost.Local. Your opinion is welcome on any or all of these. - Boost.Local's local exits provide the same functionality (and then some) as Boost.ScopeExit. Does this duplication of functionality need to be dealt with, and if so, how? - Lorenzo is proposing to add boost::local::function:: overload to Boost.Function as boost::function::overload. See https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost/loca... - Lorenzo is proposing to add BOOST_IDENTITY_TYPE to boost/utility. See https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/BOOST_IDEN... - Likewise, Lorenzo is proposing to add BOOST_IDENTITY_VALUE to boost/utility. See https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/BOOST_IDEN... -------- Lastly, please note that Boost.Local has included a copy of the Variadic Macro Data (VMD) library in boost/detail/preprocessor/variadic_macro_data. Since then, VMD has been modified and integrated into Boost.Preprocessor. After the review has concluded, Lorenzo will remove this local copy of the VMD library and replace its usage within Boost.Local with the Boost.Preprocessor variadic extensions. -------- Thanks in advance to all who participate in the review discussion; I'm looking forward to it! - Jeffrey Hellrung (Review Manager) - Gregory Crosswhite (Review Assistant)

From: mailto:boost-users-bounces@lists.boost.org boost-users-bounces@lists.boost.org mailto:[mailto:boost-users-bounces@lists.boost.org] [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Jeffrey Lee Hellrung, Jr. Sent: Thursday, November 10, 2011 5:53 AM To: mailto:boost-announce@lists.boost.org boost-announce@lists.boost.org; mailto:boost-users@lists.boost.org boost-users@lists.boost.org Subject: [Boost-users] [boost] Boost.Local Review (Nov 10, 2011 to Nov 19, 2011) The review of Lorenzo Caminiti's proposed Boost.Local library begins tomorrow, ***November 10, 2011***, and ends on ***November 19, 2011***. Other questions you may want to consider: - What is your evaluation of the design? I have some concern about manipulation of C++ to do things it wasn't really designed to: if C++ is intended to have local functions, it should be part of the language. 'Abuse' like this tends to cause trouble, and more important, it puts off the day when we abandon this "absurdly ambiguous language" in favour of new language X (or have we run out of letters for new languages? ;-) un-shackled by any primitive and obsolete features inherited from C. But that hasn't stopped many people making good use of such devices, for example, Boost.Parameter. - What is your evaluation of the implementation? It looks ugly and not very intuitive, but fiendishly clever with a reassuringly long set of examples & tests. Will it confuse debugging and tools like MS Intellisense? - What is your evaluation of the documentation? Very nicely produced (including, I note with approval, quite nice and full use of Doxygen-style comments to pass 'concept' information through to the C++ reference synopsis). It only lacks an index, but that could easily be added. - What is your evaluation of the potential usefulness of the library? Not fully convinced that it will be widely used, but much easier than the examples given which just (ab-)use the language features directly. - Did you try to use the library? No. - How much effort did you put into your evaluation? A quick reading of the docs. - Are you knowledgeable about the problem domain? No. Please state clearly whether you think this library should be accepted as a Boost library. Sorry but, for what little it's worth, a definite 'don't know'. I'm sure those knowledgeable about the problem domain will give more reasoned and significant votes. Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 mailto:pbristow@hetp.u-net.com pbristow@hetp.u-net.com

Le 16/11/11 16:41, Paul A. Bristow a écrit :
*From:*boost-users-bounces@lists.boost.org mailto:boost-users-bounces@lists.boost.org[mailto:boost-users-bounces@lists.boost.org] mailto:[mailto:boost-users-bounces@lists.boost.org]*On Behalf Of *Jeffrey Lee Hellrung, Jr. *Sent:* Thursday, November 10, 2011 5:53 AM *To:* boost-announce@lists.boost.org mailto:boost-announce@lists.boost.org; boost-users@lists.boost.org mailto:boost-users@lists.boost.org *Subject:* [Boost-users] [boost] Boost.Local Review (Nov 10, 2011 to Nov 19, 2011)
The review of Lorenzo Caminiti's proposed Boost.Local library begins tomorrow, ***November 10, 2011***, and ends on ***November 19, 2011***.
Other questions you may want to consider:
- What is your evaluation of the design?
I have some concern about manipulation of C++ to do things it wasn't really designed to:
if C++ is intended to have local functions, it should be part of the language.
If I'm not wrong lambdas play a role similar to unnamed local functions, and they are already in the language. The intent of Boost.Local is to provide something similar on compilers that doesn't support lambdas.
'Abuse' like this tends to cause trouble, and more important, it puts off the day when we abandon this "absurdly ambiguous language" in favour of new language X (or have we run out of letters for new languages? ;-) un-shackled by any primitive and obsolete features inherited from C.
Well, you know, the first uses of exceptions and templates in C++ were possible thanks to some preprocessor magic libraries. While incomplete, these 'emulations' allowed to some of us to start using these features and surely pushed to include them properly on the language later on. The preprocessor is a really useful tool that has his place in such contexts. Unfortunately, the local function emulation needs to bind explicitly the used variables. I think, that even with lambdas in the language, local functions will have his place, as soon as they provide access to the enclosing function data.
But that hasn't stopped many people making good use of such devices, for example, Boost.Parameter.
Yes this is another example of things that could be included in the language and in this case that can be emulated using a library. I understand that a language can not include all the features desired by each user, and that there could be other missing features with a higher added value, but there is one feature that I think is missing in C++: the scoped exit/success/failure as defined in language D. I hope the emulation of Boost.ScopedExit or Boost.Local could show its usefulness and that someone will make a concrete proposal to the standard committee. Best, Vicente

From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Vicente J. Botet Escriba Sent: Wednesday, November 16, 2011 6:21 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost] Boost.Local Review (Nov 10, 2011 to Nov 19, 2011) Le 16/11/11 16:41, Paul A. Bristow a écrit : From: mailto:boost-users-bounces@lists.boost.org boost-users-bounces@lists.boost.org mailto:[mailto:boost-users-bounces@lists.boost.org] [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Jeffrey Lee Hellrung, Jr. Sent: Thursday, November 10, 2011 5:53 AM To: mailto:boost-announce@lists.boost.org boost-announce@lists.boost.org; mailto:boost-users@lists.boost.org boost-users@lists.boost.org Subject: [Boost-users] [boost] Boost.Local Review (Nov 10, 2011 to Nov 19, 2011) The review of Lorenzo Caminiti's proposed Boost.Local library begins tomorrow, ***November 10, 2011***, and ends on ***November 19, 2011***. Other questions you may want to consider: - What is your evaluation of the design? I have some concern about manipulation of C++ to do things it wasn't really designed to: if C++ is intended to have local functions, it should be part of the language. If I'm not wrong lambdas play a role similar to unnamed local functions, and they are already in the language. The intent of Boost.Local is to provide something similar on compilers that doesn't support lambdas. 'Abuse' like this tends to cause trouble, and more important, it puts off the day when we abandon this "absurdly ambiguous language" in favour of new language X (or have we run out of letters for new languages? ;-) un-shackled by any primitive and obsolete features inherited from C. Well, you know, the first uses of exceptions and templates in C++ were possible thanks to some preprocessor magic libraries. While incomplete, these 'emulations' allowed to some of us to start using these features and surely pushed to include them properly on the language later on. The preprocessor is a really useful tool that has his place in such contexts. Unfortunately, the local function emulation needs to bind explicitly the used variables. I think, that even with lambdas in the language, local functions will have his place, as soon as they provide access to the enclosing function data. But that hasn't stopped many people making good use of such devices, for example, Boost.Parameter. Yes this is another example of things that could be included in the language and in this case that can be emulated using a library. I understand that a language can not include all the features desired by each user, and that there could be other missing features with a higher added value, but there is one feature that I think is missing in C++: the scoped exit/success/failure as defined in language D. I hope the emulation of Boost.ScopedExit or Boost.Local could show its usefulness and that someone will make a concrete proposal to the standard committee. OK, I'm just playing the Devil's Advocate here. I'm sure that checking usefulness with fancy macros is one route for language development (but not the only one). It certainly allows many people to see how useful they find the feature without a major language change. And I suspect it will be found useful - but I'm not sure how useful. Paul

On Thu, Nov 10, 2011 at 12:52 AM, Jeffrey Lee Hellrung, Jr.
The review of Lorenzo Caminiti's proposed Boost.Local library begins tomorrow, ***November 10, 2011***, and ends on ***November 19, 2011***.
Boost.Local implements local functions, local blocks, and local exits for the C++ programming language. It allows one to define a function at any declarative scope, including function scope; bind variables from the enclosing scope; and pass this function to templated STL-style algorithms.
First comment: when I saw the name Boost.Local, I immediately assumed it was related somehow to Boost.Locale. That is, the name suggests that it somehow helps you localize an internationalized application. The description above came as a surprise to me. Though I can't remember exactly where, I think there was a suggestion to name this library something more like "Boost.Scope," which would be more intuitive. I would like to request that (or similar) name change. Why does the name matter? Because there are so many Boost libraries that one's first problem is to determine at a glance whether Boost even has a library to address one's current problem -- and which library that might be. Once you've focused on a particular library, of course you read its documentation to discover the details. But for most of us, reading through all documentation for all Boost libraries is simply not practical. If I were looking for a tactic to pass a nested function to an STL algorithm, I'm afraid I'd have skimmed right past the name "Boost.Local" without further investigation. If the name of a proposed Boost library might possibly be ambiguous, it seems important to me to try to make it less so.
Please state clearly whether you think this library should be accepted as a Boost library.
I vote conditional YES. Conditions synopsized at end.
Other questions you may want to consider:
- What is your evaluation of the design? - What is your evaluation of the implementation? - What is your evaluation of the documentation?
The documentation is laudably clear.
- What is your evaluation of the potential usefulness of the library?
I definitely like the ability to construct nested functions to pass to STL algorithms. Thumbs up for BOOST_LOCAL_FUNCTION_*. I must admit I'm not fully convinced of the utility of BOOST_LOCAL_BLOCK, given the existing ability to do this: int i = 17; { const int& locali(i); ++locali; // ERROR } Using BOOST_LOCAL_BLOCK seems like a lot of typing, and the risk of making the code harder for your colleagues to read, for what it gains. Having worked with both try/finally (in some languages, that's all you get) and with RAII, courtesy of stack objects with constructors and destructors, I much prefer RAII. So for me, BOOST_LOCAL_EXIT is of dubious utility as well. I recognize the value of being able to express cleanup immediately following the corresponding acquisition; but if I'm going to acquire this resource in one place, chances are I'll end up needing to acquire it in other places too, so I may as well write the class that logically encapsulates it. That encapsulation is usually harder to express with try/finally, and I don't see how BOOST_LOCAL_EXIT would do better. That said, I recognize that others may differ on this point.
- Did you try to use the library? With what compiler? Did you have any problems?
did not try
- How much effort did you put into your evaluation? A glance? A quick reading? In-depth study?
I read the online documentation.
Please also consider the following issues and proposals specific to Boost.Local. Your opinion is welcome on any or all of these.
- Boost.Local's local exits provide the same functionality (and then some) as Boost.ScopeExit. Does this duplication of functionality need to be dealt with, and if so, how?
BOOST_LOCAL_EXIT does indeed seem wholly redundant with Boost.ScopeExit. I don't think both should be equivalently supported in Boost: how should a coder pick? If there really are semantic differences between them, then the documentation for each must be very clear about those distinctions. If there are not, one should be eliminated. It would make some sense to me to fold Boost.ScopeExit into this library, perhaps with forwarding headers for backwards compatibility.
- Lorenzo is proposing to add boost::local::function::overload to Boost.Function as boost::function::overload. See https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost/loca...
YES! overload has no compelling relationship to Boost.Local. It really does belong in Boost.Function.
- Lorenzo is proposing to add BOOST_IDENTITY_TYPE to boost/utility. See https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/BOOST_IDEN...
This seems generally useful, yes. In fact it should probably show up in a Boost FAQ for trying to pass arbitrary types to macros.
- Likewise, Lorenzo is proposing to add BOOST_IDENTITY_VALUE to boost/utility. See https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/BOOST_IDEN...
This is one point on which the documentation is not clear. For an
expression that evaluates to a runtime value, what's the benefit of
(e.g. from the cited page) BOOST_IDENTITY_VALUE((key_sizeof
--------
Lastly, please note that Boost.Local has included a copy of the Variadic Macro Data (VMD) library in boost/detail/preprocessor/variadic_macro_data. Since then, VMD has been modified and integrated into Boost.Preprocessor. After the review has concluded, Lorenzo will remove this local copy of the VMD library and replace its usage within Boost.Local with the Boost.Preprocessor variadic extensions.
--------
Conditions: 1. Rename library to something less ambiguous (avoid resonance with internationalization). 2. Cage match with Boost.ScopeExit. 3. Move 'overload' to Boost.Function. It doesn't belong in Boost.Local. 4. Move BOOST_IDENTITY_TYPE to boost/utility. 5. Use official Boost.Preprocessor VMD support rather than a library-specific copy. Comments: * For me the value of this library is BOOST_LOCAL_FUNCTION_PARAMS/NAME. It doesn't matter much to me whether BOOST_LOCAL_EXIT or BOOST_LOCAL_BLOCK come along for the ride. * I don't really see the point of BOOST_IDENTITY_VALUE either.

Thanks for the review Nat! Just one comment:
On Fri, Nov 18, 2011 at 9:29 AM, Nat Linden
On Thu, Nov 10, 2011 at 12:52 AM, Jeffrey Lee Hellrung, Jr.
wrote:
[...]
- Likewise, Lorenzo is proposing to add BOOST_IDENTITY_VALUE to boost/utility. See https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/BOOST_IDEN...
This is one point on which the documentation is not clear. For an expression that evaluates to a runtime value, what's the benefit of (e.g. from the cited page) BOOST_IDENTITY_VALUE((key_sizeof
::value)) vs. the simpler and more obvious extra set of parentheses: (key_sizeof ::value) ?
Uh, seems like a good point that I definitely overlooked! Lorenzo, do you have a use case where the extra set of parentheses posed a problem? - Jeff
participants (4)
-
Jeffrey Lee Hellrung, Jr.
-
Nat Linden
-
Paul A. Bristow
-
Vicente J. Botet Escriba