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

Revisit codegen for self-referential messages #240

Open
Drvi opened this issue Nov 15, 2023 · 0 comments
Open

Revisit codegen for self-referential messages #240

Drvi opened this issue Nov 15, 2023 · 0 comments

Comments

@Drvi
Copy link
Member

Drvi commented Nov 15, 2023

E.g.:

syntax = \"proto3\";
message ShapeMessage {
    float shape = 1;
    repeated ShapeMessage shapeChild = 2;
    optional float dbtype = 3;
}

will be translated to:

abstract type var"##AbstractShapeMessage" end
struct ShapeMessage <: var"##AbstractShapeMessage"
    shape::Float32
    shapeChild::Vector{<:ShapeMessage}
    dbtype::Float32
end

Making shapeChild an abstractly typed field. The simpler and better-performing thing would be to generate this:

struct ShapeMessage
    shape::Float32
    shapeChild::Vector{ShapeMessage}
    dbtype::Float32
end

Which seems to work fine.

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

No branches or pull requests

1 participant