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

Interest in contributions for C++23 Monadic functions? #104

Closed
cmazakas opened this issue Sep 2, 2022 · 5 comments
Closed

Interest in contributions for C++23 Monadic functions? #104

cmazakas opened this issue Sep 2, 2022 · 5 comments

Comments

@cmazakas
Copy link
Member

cmazakas commented Sep 2, 2022

https://en.cppreference.com/w/cpp/utility/optional

C++23 added some new monadic functions.

I see these already exist under the names value_or_eval, map and flat_map.

The contribution here would be adding the C++23 compatible member function names and then correspondingly updating the existing tests. Is there any interest in getting something like this included? I'd be volunteering here.

@akrzemi1
Copy link
Member

akrzemi1 commented Sep 3, 2022

Hi. Thank you for your interest in the library, and for your contribution offer. If I understand correctly, we are talking about adding new names to an already existing functionality, right?

It is worth giving it a thought, however note that Boost.Optional does not aim at 100% compatibility with std::opitonal, for instance:

  • it has tag boost::none rather than boost::nullopt,
  • it has tag in_place_init rather than in_place (which is reserved in Boost for in-place factories),
  • it doesn't have converting constructors between optional<U> and optional<T>, which cause consistency bugs in std::optional

Not to mention that boost::optional offers a bigger interface.
So, the users already have to be aware which optional they are using.

@cmazakas
Copy link
Member Author

cmazakas commented Sep 3, 2022

If I understand correctly, we are talking about adding new names to an already existing functionality, right?

Yup! This would be so boost::optional is a drop-in replacement and vice versa, acting as a polyfill for eventual C++23 code.

it doesn't have converting constructors between optional and optional, which cause consistency bugs in std::optional

Would you like this as well?

@akrzemi1
Copy link
Member

akrzemi1 commented Sep 3, 2022

it doesn't have converting constructors between optional and optional, which cause consistency bugs in std::optional

Would you like this as well?

Nope. This converting constructor has a number of gotchas, and is therefore bug prone.

@cmazakas
Copy link
Member Author

cmazakas commented Sep 6, 2022

Alright, so sounds like a no-go which is cool to me. In the interim, if there's anything you'd like contributions for, just let me know!

I'm going to go ahead and close this issue as it seems resolved to me.

@cmazakas cmazakas closed this as completed Sep 6, 2022
@akrzemi1
Copy link
Member

akrzemi1 commented Sep 6, 2022

Sure. thanks. For instance, we have this one: #105

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

No branches or pull requests

2 participants