Skip to content
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

[Motions 2022 11 lwg 13] P2505R5 Monadic Functions for std::expected #5993

Merged
merged 2 commits into from Dec 15, 2022

Conversation

RobertLeahy
Copy link
Contributor

@RobertLeahy RobertLeahy commented Nov 20, 2022

@jensmaurer
Copy link
Member

@RobertLeahy , please fix the sanitizer warnings.

Note that you can run the checker manually using ../tools/check-output.sh and ../tools/check-source.sh

Please add a "Fixes" line enumerated the NB comments addressed to the commit description.

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 20, 2022

Right, so the commit message should be:

P2505R5 Monadic Functions for std::expected

Fixes NB XX-123 (C++23 CD).

etc., and "2022-11 LWG Motion 13" is how I'll label the merge commit.

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 20, 2022

Thanks for this, @RobertLeahy!

source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
@RobertLeahy
Copy link
Contributor Author

Note that you can run the checker manually using ../tools/check-output.sh and ../tools/check-source.sh

Thanks for this, my latest push has only two sanitizer issues which I'm looking into:

::error file=utilities.tex::Overfull \hbox (21.47356pt too wide) in paragraph at lines 9470--9475
::error file=utilities.tex::Overfull \hbox (21.47356pt too wide) in paragraph at lines 9497--9502

@RobertLeahy
Copy link
Contributor Author

RobertLeahy commented Nov 20, 2022

I've resolved one of these errors with \allowbreak but it results in this:

image

I'm not sure whether we consider that acceptable or not. If it is I can resolve the other in the same way and repush.

@JohelEGP
Copy link
Contributor

You could try std::for\-ward, or transforming the code span into a code block.

@RobertLeahy
Copy link
Contributor Author

std::for\-ward works:

image

Is this considered a better result than the \allowbreak result?

@RobertLeahy
Copy link
Contributor Author

I had a draft comment on the issue (#5974) that I'll post here:

Contrasting the wording in the paper for std::expected::transform with the wording for std::optional::transform I notice that:

  • Wording for std::expected::transform is missing "for some invented variable u"
  • Is missing the note that there's no requirement that U be movable

@JohelEGP
Copy link
Contributor

Is this considered a better result than the \allowbreak result?

I think so. My impression is that there's a preference for breaking mid-word rather than at symbol-word bounds. There's a number of examples for exactly this case:

$ grep 'for\\-' *.tex
containers.tex:from \tcode{piecewise_construct}, \tcode{for\-ward_as_tuple(k)},
containers.tex:from \tcode{piecewise_construct}, \tcode{for\-ward_as_tuple(std::move(k))},
containers.tex:assigns \tcode{std::for\-ward<M>(obj)} to \tcode{e.second}.
containers.tex:from \tcode{std::move(k)}, \tcode{std::for\-ward<M>(obj)}.
containers.tex:assigns \tcode{std::for\-ward<M>(obj)} to \tcode{e.second}.
containers.tex:from \tcode{k}, \tcode{std::for\-ward<M>(obj)}.
containers.tex:assigns \tcode{std::for\-ward<M>(obj)} to \tcode{e.second}.
containers.tex:assigns \tcode{std::for\-ward<M>(obj)} to \tcode{e.second}.
ranges.tex:  each model \libconceptx{for\-ward_range}{forward_range}, then \tcode{iterator_concept} denotes
ranges.tex:then \tcode{iterator_concept} denotes \tcode{for\-ward_iterator_tag}.
threads.tex:\tcode{invoke(auto(std::forward<F>(f)), auto(std::for\-ward<Args>(args))...)}\iref{func.invoke,thread.thread.constr}
threads.tex:\tcode{auto(std::for\-ward<Args>(args))...}
utilities.tex:with \tcode{std::for\-ward<Args>(args)...}.
utilities.tex:\tcode{ilist, std::for\-ward<Args>(args)...}.

@PHSpline
Copy link

Hi, found a minor issue... std::forward is missing the 'f' argument for one of the or_else definitions:

image

Thanks

source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
@RobertLeahy RobertLeahy force-pushed the motions-2022-11-lwg-13 branch 2 times, most recently from 5f7ea21 to bb80c20 Compare December 9, 2022 16:47
Copy link
Member

@jwakely jwakely left a comment

Choose a reason for hiding this comment

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

Looks good now, thanks!

Fixes NB GB 093, US 091, US 092, FR 009 (C++23 CD).
@tkoeppe
Copy link
Contributor

tkoeppe commented Dec 15, 2022

Is this considered a better result than the \allowbreak result?

I think so. My impression is that there's a preference for breaking mid-word rather than at symbol-word bounds.

Thanks - yes, I agree, I think it can be quite confusing to have symbols and puncutation break across lines, whereas a break in the middle of a normal word is a bit more normal and expected and easier to follow.

@tkoeppe
Copy link
Contributor

tkoeppe commented Dec 15, 2022

Great work; many thanks, @RobertLeahy!

@tkoeppe tkoeppe merged commit c4eec66 into cplusplus:main Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment