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 capnproto+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to