-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Comments
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. |
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. |
👍🏻 |
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 |
@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. |
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? |
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. |
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. |
+1 on replacing. @srikailash it's easier to review if you just file a PR, thanks. |
@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) |
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 <[email protected]> Signed-off-by: JP Simard <[email protected]>
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 <[email protected]> Signed-off-by: JP Simard <[email protected]>
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.
The text was updated successfully, but these errors were encountered: