Skip to content
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

generate AnyStruct and AnyList #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

vaci
Copy link
Contributor

@vaci vaci commented Dec 16, 2020

Generate AnyStruct and AnyList types.


public static final class Factory extends ListFactory<Builder, Reader> {
Factory() {
super(ElementSize.VOID);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this end up giving a wrong value for the expectedElementSize parameter of WireHelpers.readListPointer()? Maybe we need to add a checkElementSize parameter, like in capnproto-c++? https://github.com/capnproto/capnproto/blob/master/c%2B%2B/src/capnp/layout.c%2B%2B#L2237

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That probably explains why my round-trip test for AnyList fails!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right in thinking that the actual element size has to be written out when initListPointer is called?
In that case, I think I need to allow the user to pass the appropriate factory to the generated accessor when initiialising the list for building.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. For a field

  foo @1 :AnyList

I think we should generate a method like public <B> B initFooAs(ListFactory<B, ?> factory, int size).
(capnproto-c++ does something similar)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants