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

Adopt absl::optional #2651

Closed
jsedgwick opened this issue Feb 20, 2018 · 10 comments
Closed

Adopt absl::optional #2651

jsedgwick opened this issue Feb 20, 2018 · 10 comments
Labels
beginner Good starter issues! help wanted Needs help! tech debt

Comments

@jsedgwick
Copy link

Envoy's custom Optional is anemic compared to absl (https://github.com/abseil/abseil-cpp/blob/master/absl/types/optional.h) and folly (https://github.com/facebook/folly/blob/master/folly/Optional.h)

For instance, envoy Optional doesn't have move ctors and doesn't do some finger-saving type inference.

Replace with one of the above, presumably absl's since that's already an envoy dep.
AFAICT the big-picture difference between absl's and folly's is that absl's is a drop-in replacement for std::optional (C++17). Folly's has more bells and whistles but given that envoy has been getting away with the current impl, absl is a better call.

@dnoe
Copy link
Contributor

dnoe commented Feb 21, 2018

Obviously I'm biased but I'd love to see us switch to absl::optional. This would be a nice project for a newcomer, too.

@dnoe dnoe added help wanted Needs help! beginner Good starter issues! labels Feb 21, 2018
@jsedgwick
Copy link
Author

I will take care of it when I can unless someone else snatches it up.

Don't be too surprised if I advocate for some folly components later on, though 😉 Especially Singleton, Synchronized, ThreadLocal, and the libevent wrappers.

@dio
Copy link
Member

dio commented Feb 21, 2018

👍🏻

@mattklein123
Copy link
Member

In this case I think we should definitely use absl::Optional. @jsedgwick my advice would be to not worry about this and per @dnoe leave it for a new contributor as it is a very easy item and a good first task. The current Optional that we have is clearly not as fleshed out as the others but it works fine for the cases in which we use it. As per Folly, I'm not super interested in depending on another utility library unless there is a very good reason but we can discuss those on a case by case basis.

@jsedgwick
Copy link
Author

@mattklein123 I am a new contributor :) But I have plenty on my plate so can leave it for now.

As for everything else, nothing is urgent and we can discuss once you're back. The TLDR of my viewpoint, though, is that depending on a few actively maintained components from an external library in order not to have to maintain our own is worth the cost of setting up the dependency. Especially since I would bet my bottom dollar that some of these components (esp libevent wrappers) will be very low hanging fruit for long term perf work. And the ones I have in mind are safer and less verbose to use (viz Singleton, ThreadLocal), so would have immediate code cleanliness impact. Again, this is a longer discussion to be had case by case that we can punt on for now.

@srikailash
Copy link
Contributor

srikailash commented Feb 28, 2018

I added absl::optional to envoy in this commit (https://github.com/srikailash/envoy/commit/9e8b79fdad756f859435c28bcc4c28de2980dc01) following https://github.com/envoyproxy/envoy/blob/master/bazel/EXTERNAL_DEPS.md. for further work on this issue do we need to implement a wrapper around absl::optional in envoy namespace?

@ggreenway
Copy link
Contributor

No, I don't think we should have any type of wrapper. I think we just need to replace all uses of Optional with absl::optional, and delete the existing implementation.

@srikailash
Copy link
Contributor

I added basic test to using absl:optional here https://github.com/srikailash/envoy/commit/e9dd4193766f674fc94b1fd7a29a601702a6342f. Can work on replacing if that's the way to go.

@htuch
Copy link
Member

htuch commented Feb 28, 2018

+1 on replacing. @srikailash it's easier to review if you just file a PR, thanks.

@srikailash
Copy link
Contributor

@htuch, sure. Wanted to check approach first. Thanks for the post on managing external dependencies with bazel(https://blog.envoyproxy.io/external-c-dependency-management-in-bazel-dd37477422f5)

@htuch htuch closed this as completed in 725a6a4 Mar 13, 2018
jpsim pushed a commit that referenced this issue Nov 28, 2022
Reverting #470 which is a patch to boringssl
https://boringssl-review.googlesource.com/c/boringssl/+/37804 indicates that this patch was added to avoid a linker error, so given CI passes I assume it can be reverted.

Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: n/a

Part of #23758
Fixes #471

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this issue Nov 29, 2022
Reverting #470 which is a patch to boringssl
https://boringssl-review.googlesource.com/c/boringssl/+/37804 indicates that this patch was added to avoid a linker error, so given CI passes I assume it can be reverted.

Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: n/a

Part of #23758
Fixes #471

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: JP Simard <jp@jpsim.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner Good starter issues! help wanted Needs help! tech debt
Projects
None yet
Development

No branches or pull requests

7 participants