Conversation
|
Hmm this doesn't really seem like a general solution to me. What happens when somebody tries to use a .proto message that contains field named message_fields? That said, I don't really have a better suggestion, short of moving every single Message method off the class into some other non-conflicting namespace. Maybe that is the only solution. I'll have to think on it. |
|
This will be a breaking change for everyone else, no? Something should be done though, this will come up again. And protocol buffers allows use of keywords for field names, ie you can do: optional string message = 1; So there's no obvious solution. I think it would be cleaner to move non-field methods to a non-conflicting namespace. |
|
I'm leaning towards putting everything in a non-conflicting namespace, but retaining the current methods on For example in a message: class Foo < ProtocolBuffers::Message
repeated :string, :fields, 1
endCalling This is still not strictly backwards compatible, as some generic code could see the change in precedence when reflecting on messages that override methods with fields of the same name. However, that same generic code isn't able to properly handle such messages today, so it seems like an acceptable compromise. |
I'm implementing a client library for Mozilla Heka, and their message.proto contains a
fieldsfield to embed moreFieldmessage type. Although I don't agree with their decision, the ruby client should support that format.When the
Messagemessage type compiled byruby-protocol-bufferstries to initiate itself with thefieldsfield in it, runs into an infinite loop. I know, the whole thing seems ridiculous.My first proposal is to add a
message_prefix tofields. If you have a better naming convention, I'll change this.