In a CapnProto schema is there any way to forward-declare structs so you can make a tree structure like this:
struct ExecuteProgram {
code @0 :Text;
}
struct SequenceProgram {
programs @0 :List(Program)
}
struct IfProgram {
condition @1 :Program;
trueBody @2 :Program;
falseBody @3 :Program;
}
struct Program {
union {
execute @0 :ExecuteProgram;
sequence @1 :SequenceProgram;
if @2 :IfProgram;
}
}
If I try to compile this the compiler gives the very helpful error message Parse error
. I assume it is complaining because I use Program
before it is declared.
Is there any way around this?
It turns out you don't need forward declarations, I was just missing a semicolon. What was I saying about Parse error
being a terrible error message?