Hello, On Tue, Jan 24, 2023 at 1:10 PM Kenton Varda <ken...@cloudflare.com> wrote:
> You mean SchemaLoader::getType(), right? > Correct. > case schema::Type::LIST: > return ListSchema::of(getType(proto.getList().getElementType(), scope)); > > So the returned type should not lose the fact that the type represents a > list (or list-of-lists, or list-of-list-of-lists, etc.). > > Do you have some code that doesn't work as you expect, that you could > share? > When looking at the code above, the recursion seemed to pretty much return a type representing List(struct) rather than List(List(struct)), I am not sure iterating over the DynamicList is doing the right thing. My code is crashing, so assumed I was doing something wrong. Let me work on a self contained example, don't have one handy. Fundamentally... Once getType() returns, I have a capnp::Type that I can use to build a DynamicList, which I can use to iterate over the elements. Iterating over the elements is moving through the outer list, and returns a DynamicValue. Now I need to iterate over the elements on the inner list. To go from DynamicValue to another DynamicList... use getType() passing in getList().getElementType() (recursing inside once), and then DynamicValue.of<DynamicList<...>>? Thanks, Carlo -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/CAN6NmwcG7_SsvxfFKEcJVzSBiyLUyFOrgKdFrd1W7AVH3Oiu-A%40mail.gmail.com.