--Thanks,Saurabh
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
I meant something like:
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
It probably wouldn’t be difficult to implement, but it’s not, afaik, a design goal for protocol buffers because it is almost never (if ever) necessary.
There are two composition approaches available, depending on what your needs are. Contain the common stuff:
message Common {
required string account = 1;
required string symbol = 2;
}
message MSG1 {
required common = 1
}
message MSG2 {
required common = 1
required int32 id = 2;
}
Or contain the variable stuff:
message MSG {
required string account = 1;
required string symbol = 2;
optional Extra1 extra1 = 3;
optional Extra2 extra2 = 4;
message Extra1 {
required int32 id = 1;
}
message Extra2 {
required string foo = 1;
}
}
with proto3, you can do slightly better:
message MSG {
string account = 1;
string symbol = 2;
oneof extra {
Extra1 extra1 = 3;
Extra2 extra2 = 4;
}
message Extra1 {
int32 id = 1;
}
message Extra2 {
string foo = 1;
}
}
If composition is not what you want, then why not? What real-world problem do you have that cannot be effectively solved with one of the above strategies?
I see two problems with this approach. It is neither cut & paste nor personal preference issue as I see. The real issues I see are:1) The base message (MSG in the example) and the extended message (MSG2 in the example ) can belong to different package owned by different group/org. The package defining base message (MSG) (call it Pkg1) does not event know the existing of the package defining extended message (MSG2) (call it Pkg2). How can the base message foresee all the extended message from it? Even if Pkg1 and Pkg2 are owned by the same group/org, making Pkg1 aware of Pkg2 is not a good idea as it can potentially create cyclic dependencies.2) Polymorphic Lists: I have a list of MSG types which can potentially have both MSG and MSG2 types. How is this modeled in proto3 using the proposed solution?These are real issues which I am facing right now. Any suggestions to handle the above problems would be of great help.
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Protocol Buffers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/protobuf/ojpYHqx2l04/unsubscribe.
To unsubscribe from this group and all its topics, send an email to protobuf+u...@googlegroups.com.