Skip to content

Feature request: allow to return value from C++ proxying API #20611

Open
@RReverser

Description

@RReverser

It would be nice to be able to return custom value directly from queue.proxySync(...) / proxySyncWithCtx / proxyCallback's callback high-level APIs.

Most proxying operations require returning a value, but right now the closest workaround is to create a value with default constructor and override it from the callback, which is a bit cumbersome and also not ideal when default constructor is potentially expensive. Another alternative is to use std::optional + emplace, which is less expensive, but even more cumbersome.

I'm not sure how that would play with bool - I guess bool should stay as the return type for proxySync<void> and then std::optional<T> would be the return type for proxySync<T>? Personally I almost always need to hard assert on proxying being successful, so I'd also be happy with something like T proxySyncChecked<T>() which would just throw exception / abort on proxying failure and return value directly otherwise.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions