Skip to content

[2025-06 LWG Motion 34] P3552R3 Add a Coroutine Task #8032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dietmarkuehl
Copy link

@dietmarkuehl dietmarkuehl commented Jun 29, 2025

I have applied the changes for P3552r3 (Add a Coroutine Task Type). Compared to the actual text of P3552r3
I made some [I think editorial] changes:

  • added with_error and change_coroutine_scheduler declarations to the synopsis before task; they are in the detailed description but not in the synopsis (possibly they should only be in the synopsis) as there is no further description)
  • inconsistent default template arguments for the ctor in the class declaration (allocator and the later description (allocator); the wording consistently uses allocator
  • added "of the" to a sentence about the type of a completion datum: "... defines the type of the value completion datum"
  • the use of the template parameter of the nested type state is Rcvr which has two problems: 1. the ctor also uses the name Rcvr for its template parameter 2. the class stores an object of type R which is the receiver named rcvr the most logic fix is to use Rcvr consistently for the state and change the name for the ctor's parameter:
    1. change the ctor template parameter type to use R
    2. change the member to use Rcvr
    3. change the type R used for the own-env-t to be "...get_env(declval())..."

Fixes #7971
Fixes cplusplus/papers#2200

I have applied some [I think editorial] changes compared to P3552r3:

- added with_error and change_coroutine_scheduler declarations to
    the synopsis before task; they are in the detailed description but
    not in the synopsis (possibly they should only be in the synopsis)
    as there is no further description)
- inconsistent default template arguments for the ctor
    in the class declaration (allocator<byte> and the later description
    (allocator<void>); the wording consistently uses allocator<void>
- added "of the" to a sentence about the type of a completion datum:
    "... defines the type *of the* value completion datum"
- the use of the template parameter of the nested type state is Rcvr
    which has two problems:
       1. the ctor also uses the name Rcvr for its template parameter
       2. the class stores an object of type R which is the receiver
          named rcvr
  the most logic fix is to use Rcvr consistently for the state and
  change the name for the ctor's parameter:
    1. change the ctor template parameter type to use R
    2. change the member to use Rcvr
    3. change the type R used for the own-env-t to be
       "...get_env(declval<Rcvr>())..."
The CI objected to use of \exposid{sender} => renamed sender to
ts-sender. This change should be editorial but is more invovled
@jensmaurer jensmaurer changed the title FIXES: 7971 [2025-06 LWG Motion 34] P3552R3 Add a Coroutine Task [2025-06 LWG Motion 34] P3552R3 Add a Coroutine Task Jun 30, 2025
Copy link
Member

@Eisenwave Eisenwave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for drafting this up.

Lots of work required before this is ready to go.

Also note that fixing up CI builds is not a fixup commit; it should just go into the main commit. The point of fixups is just to distinguish between turning the paper into TeX, and fixing typos and other minor issues afterwards.

Massaging whitespace or paragraph justification is not a separate commit.

whose promise type has an \tcode{unhandled_stopped} member function, or

\item%
when an exception is thrown from a coroutine \tcode{std::execution::task}\iref{exec.task} which doesn't support a \tcode{std::execution::set_error_t(std::execption_ptr)} completion.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
when an exception is thrown from a coroutine \tcode{std::execution::task}\iref{exec.task} which doesn't support a \tcode{std::execution::set_error_t(std::execption_ptr)} completion.
when an exception is thrown from a coroutine \tcode{std::execution::task}\iref{exec.task}
which doesn't support a \tcode{std::execution::set_error_t(std::exception_ptr)} completion.

This line is overly long, the paper has a typo that needs to be fixed up, and added \irefs should typically go into a separate fixup commit. I do like the extra \iref though.

class @\libglobal{task_scheduler}@;

// \ref{exec.task}
template<class E>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New declarations like these should be in a separate commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What? The incoming paper is missing a declaration? That's at least worth a proper non-fixup "[blah.syn] Add missing declarations" commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As dietmar explained above, those definitions exist, but are missing declarations in the synopsis.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. And those declarations seem to have no add-on info, so they probably should exist in the synopsis only.

Comment on lines +5697 to +5700
\tcode{affine_on} adapts a sender into one that completes on
the specified scheduler. If the algorithm determines that the adapted
sender already completes on the correct scheduler it can avoid any
scheduling operation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repository uses semantic line breaks (https://sembr.org/). I don't want to bother you too much, but please put new sentences on a separate line at least. That is, newline after ..

Note that the TeX still renders the same whether you put a space or a newline into the source.

except that \tcode{sndr} is evalutated only once.

\pnum
The exposition-only class template \exposid{impls-for}\iref{exec.snd.general}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New \irefs should be in a separate commit.

\begin{codeblock}
namespace std::execution {
template<>
struct @\exposid{impls-for}@<affine_on_t>: @\exposid{default-impls}@ {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
struct @\exposid{impls-for}@<affine_on_t>: @\exposid{default-impls}@ {
struct @\exposid{impls-for}@<affine_on_t> : @\exposid{default-impls}@ {

Comment on lines +6416 to +6417
\tcode{as_awaitable(affine_on(\linebreak std::forward<Sender>(sndr), % avoid Overfull
SCHED(*this)), *this)}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\tcode{as_awaitable(affine_on(\linebreak std::forward<Sender>(sndr), % avoid Overfull
SCHED(*this)), *this)}.
\tcode{as_awaitable(affine_on(\brk{}std::forward<Sender>(sndr), \exposid{SCHED}(*this)), *this)}.

Comment on lines +6428 to +6429
Equivalent to: \tcode{returns await_transform(just(exchange(SCHED(*this),
\linebreak scheduler_type(sch.scheduler))), *this);} % avoid Overfull
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Equivalent to: \tcode{returns await_transform(just(exchange(SCHED(*this),
\linebreak scheduler_type(sch.scheduler))), *this);} % avoid Overfull
Equivalent to:
\begin{codeblock}
return await_transform(just(exchange(SCHED(*this), scheduler_type(sch.scheduler))), *this);
\end{codeblock}

Note the typo in returns (paper has this), but I think this doesn't really need a separate commit.

\pnum
\effects
If the signature \tcode{set_error_t(exception_ptr)} is not an element
of \tcode{error_types}, calls \tcode{terminate()} \iref{except.terminate}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
of \tcode{error_types}, calls \tcode{terminate()} \iref{except.terminate}.
of \tcode{error_types}, calls \tcode{terminate()}\iref{except.terminate}.

Comment on lines +6493 to +6494
\tcode{PAlloc} is \tcode{allocator_traits<Allocator>::template
rebind_alloc\linebreak<U>} where \tcode{U} is an unspecified type % avoid Overfull
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\tcode{PAlloc} is \tcode{allocator_traits<Allocator>::template
rebind_alloc\linebreak<U>} where \tcode{U} is an unspecified type % avoid Overfull
\tcode{PAlloc} is \tcode{allocator_traits<Allocator>::template
re\-bind_alloc\brk{}<U>} where \tcode{U} is an unspecified type

coroutine state of size \tcode{size}, and unspecified additional
state necessary to ensure that \tcode{operator delete} can later
deallocate this memory block with an allocator equal to \tcode{palloc}.
\pnum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\pnum
\pnum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pnum needs an empty line in front (or a \begin{itemdescr}, otherwise it's not functioning properly.

@jensmaurer
Copy link
Member

@Eisenwave and @dietmarkuehl , let me recap the general rules for paper pull requests, and their rationale.

  • We generally do not want force-pushes during paper application, because that might impede in-flight review. (We're fine with / encourage force-pushes for non-paper pull requests.)
  • Any commit prefixed by "fixup" in the title will be squashed when @tkoeppe merges the pull request. These are the kind of commits that should appear when you've forgotten to apply a change in the incoming paper. Obviously, we don't want to keep this for posterity. Having a separate commit also helps with "look, I've really fixed that". Since this will be squashed, the commit description doesn't matter a lot (of course, it should be readable).
    For example, "fixup: add indexing" is a perfectly fine commit title here (provided the contents is related to the title). Or "fixup: avoid overfull hboxes".
  • Punctuation fixes (Oxford comma, after bullets, after subordinate clauses etc.) should be done silently in the original commit, or as a "fixup" later (if you notice punctuation issues after creating the pull request).
  • More involved, but still "obviously editorial" fixes should be mentioned in the original commit description, e.g. "dissolved lone subclause X" or "marked exposition-only identifiers"
  • Anything beyond that warrants a separate, proper editorial commit in the usual format "[sub.clause.label] What is changed".

Adding cross-references to definitions of terms is probably in the "obviously editorial" area, but requires a check whether the xref is pointing to the right place (and thus is putting additional burden on the reviewers). Having a separate, proper editorial commit "[sub.clause.label] Add cross-references to term definitions" would be a bit more transparent, and clearly differentiates paper content from add-on editorial fixes. Occasionally, cross-references are normative (we mean exactly those situations), and changing / amending them would not be editorial.

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[2025-06 LWG Motion 34] P3552R3 Add a Coroutine Task Type P3552 R2 Add a Coroutine Task Type
3 participants