Hi Johannes,

Thanks for the feedback.

I'm curious: In your use case, does the caller somehow know in advance when
getValue() is going to return an interface, thus allowing pipelining? If
so, would it make sense to have a separate method, e.g. getInterface(), for
that case, which just returns the interface without the union, thus
allowing pipelining today? Or if the caller does not know in advance, then
what would you like the behavior to be if the caller makes a pipelined
request but the result ends up not being an interface? I guess the
pipelined call should throw an exception?

-Kenton

On Wed, May 31, 2017 at 2:00 AM, Johannes Zeppenfeld <[email protected]>
wrote:

> Hi Kenton,
>
> I'm reviving this thread because I've just had the same wish - to be able
> to pipeline a union access. I have a type-erased interface Getter that can
> return its value through a union struct. The returned value could be either
> a builtin type, a struct or an interface:
>
> interface MyInterface {
>  myFunction @0 ();
> }
>
> struct Any {
>  union {
>   invalid @0 :Void;
>   uint32 @1 :UInt32;
>   myInterface @2 :MyInterface;
>   # etc...
>  }
> }
>
> interface Getter {
>  getValue @0 () -> (value :Any);
> }
>
>
> Given a Getter and wanting to create the associated MyInterface client, I
> currently need to do two round trips:
>
> MyInterface::Client myInterface = getter.getValueRequest().send().then(
>   [](capnp::Response<Getter::GetValueResults> &&response)
>   -> MyInterface::Client {
>     return response.getValue().getMyInterface();
>   }
> );
>
>
> It would be a welcome optimization (both performance-wise and
> boilerplate-wise) to be able to pipeline this:
> MyInterface::Client myInterface = getter.getValueRequest().send()
>                                   .getValue().getMyInterface();
>
>
> Just to add another voice to those desiring this feature :)
>
> Thanks for your work on this amazing library!
> Johannes
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to