Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2024-02-05 00:47:37

On 1/15/24 22:50, Дмитрий Архипов via Boost wrote:
> Dear Boost community, the formal review of Boost.Scope has taken place
> between 26th of November and 5th of December of the previous year. I
> have received 5 reviews in total, including 4 here on the mailing list
> and 1 on Reddit. Two of the reviews recommended unconditional, and 3
> conditional acceptance. The
> reviews came from:
> - Klemens Morgenstern,
> - Janko Dedic,
> - Julien Blanc,
> - David Sankel,
> - /u/jonesmz on Reddit.
> Also, several people have given insightful comments but did not provide a
> review. I would like to thank all of the people who took their time to write
> reviews or participate in the discussions. Your effort was very important and
> valuable.
> The outcome of the review is that Boost.Scope is ACCEPTED with several minor
> 1. noexcept specification on destructors of scope guards should be properly
> documented. Andrey has already commented that the technical hurdle that
> prevented it was eliminated.
> 2. There should be a good motivating example for scope_success. There was a lot
> of comments regarding scope_success and its seeming uselessness. Without a
> good example I see the same pattern occurring with future users.
> 3. The examples should better describe what they are trying to achieve. Several
> comments about examples suggested incorrect changes, which signals that readers
> failed to understand them.
> After a lot of consideration I decided against requesting the author to remove
> unique_resource and related functionality from the library. While several
> reviewers wanted a more "concise" library, all noted that the component is
> useful.
> One last thing I wanted to point out is that all reviewers and most commenters
> were adamant that compatibility with the Technical Specification on which this
> library was initially based should not be a goal. In fact, Andrzej Krzemienski
> even noted that such compatibility has prevented him from adequately evaluating
> the library on its own merit. In my opinion this should be a sign to all of us
> that people prefer better APIs over standard APIs. I recommend Andrey to
> re-evaluate those parts of the library's APIs that he copied from the TS and
> potentially pick better names for member functions.
> Thanks to Andrey for submitting this library to Boost. And thanks again to the
> reviewers and everyone who provided feedback, who ultimately made this review
> possible.

I have updated the library according to review comments and conditions.
To specifically address the acceptance conditions:

1. Noexcept specifications for destructors are now present in the docs.
For example:

The fix for the BoostBook stylesheets is currently in develop.
Hopefully, it will get merged to master soon.

2. I have added an example showing usage of all three conditional scope
guards, including scope_success, here:

The example is based on the one I posted during the review.

3. I have added more comments to some examples, as well as the
discussion around them. For example, the examples on the front page are
better commented now:

Some examples were modified or completely rewritten. For example, the
locked_write_string was modified to reduce code duplication:

The leading example for unique_resource was rewritten:

And a new example for unique_resource was added on the front page:

There are many more additions and modifications than I can mention here.

There were also changes that were requested by reviewers or were the
result of the discussion. The changelog here lists most of the changes:

To mention the most prominent changes:

* BOOST_SCOPE_FINAL was renamed to BOOST_SCOPE_DEFER and scope_final to
* The `release()` member of scope guards was removed. `set_active()` is
still present and is the way to activate and deactivate scope guards.
* Added `operator bool()` to `unique_resource`.
* Added a C++17 `unallocated_resource` class template that simplifies
declaration of resource traits when all unallocated resource values can
be listed. Along with the recently added to Boost.Core `functor`
template, this can significantly reduce the amount of code one needs to
write to declare a `unique_resource`. For example, a `unique_resource`
for Windows handles could be declared like this:

    functor< CloseHandle >,
    unallocated_resource< INVALID_HANDLE_VALUE, (HANDLE)NULL >
> handle;

* `unique_resource` now enforces requirements on the resource traits
with static asserts rather than falling back to the "no resource traits"
mode of operation.
* `unique_resource` no longer supports the "reduced" resource traits,
where the traits were only used to customize the default resource value
but not to distinguish allocated and unallocated resource values.
* Added documentation sections discussing differences with the Library
Fundamentals TS:

* On the front page, removed comparison with Boost.ScopeExit from the
table. There is a separate section for it:

Also added another row to the table that shows explicit deactivation of
the scope guards by calling `set_active(false)`.

* There is now a section discussing caveats of capturing variables by
reference in scope guards:

There are probably other changes that I forgot to mention.

Dmitry, please let me know if you consider the review conditions
satisfied or if there needs to be done something more.

If everything's fine, what needs to be done to move the library into

Boost list run by bdawes at, gregod at, cpdaniel at, john at