
Le 19/11/11 23:08, Lorenzo Caminiti a écrit :
On Sat, Nov 19, 2011 at 3:59 PM, Alexander Nasonov<alnsn@yandex.ru> wrote:
This is not a full review of the proposed Boost.Local library, I've reviewed only Local Exits and a potential merge with Boost.ScopeExit. Hello Alex and thank you very much for your comments.
I vote NOT to merge Local Exits with Boost.ScopeExit for the following reasons: I have no problem with local exits and scope exits remaining separate. Local exits will additionally provide no bindings (void), const bindings, and binding of this_.
- Local Exits feature gives two different interfaces ("variadic" and "sequencing"). In my opinion, it should only document C++0X interface and have a section called something like "What if I don't have a C++0X compliant compiler?" where it will explain an Yes, the same comment was made by Vicente and Thomas for the entire Boost.Local. I am happy to just document the variadic syntax and have an Annex with the sequencing syntax.
alternative interface for a transitional period. Some compilers already support enough C++0X features to let you develop a "perfect" interface. - Binding of variables should be modeled after lambda captures. This means no this_ and no void. I really like void and I'd added it if Lorenzo came up with the idea at the time when Boost.ScopeExit was still in development.
FYI, I can write pp code that transforms void, this_, etc into lambda captures. For example:
TO_CAPTURE(void) // expand to [] TO_CAPTURE(this_,&x) // expand to [this,&x] TO_CAPTURE( (this_) (&x) ) // expand to [this,&x]
This way SCOPE_EXIT(void) and SCOPE_EXIT( (this_) (&x) ) or even SCOPE_EXIT(this_,&x) could support void and this_ while still working on both C++03 and C++11...
- For the same reason, const bind& and bind& should be removed from the interface. Well, if local exits are not merged with scope exits, local exits can keep const bind&, bind&, this_, void, etc.
Hi Lorenzo, I wouldn't want two libraries providing Scope Exit idiom in Boost with only a minor binding difference, this will be confusing. I don't know if you have explained this in the document , but could you try to explain here (or point where in the documentation) what are the clear advantages of capturing void, this or capturing by const&. Alex, could you explain why (a part form following the lambda capture), you don't want to accept these new bindings in ScopedExit? Best, Vicente