On Mon, Oct 25, 2010 at 16:10, maninder batth <batth.manin...@gmail.com> wrote:
> I disagree. You could encode field name in the binary. Then at de-
> serialization, you can read the field descriptor and reconstruct the
> field. There is absolutely no need for tags. They are indeed
> cumbersome.

If you include the field name, then your throw out part of the
advantages of protocol buffers out of the window: speed and compact
binary encoding.

>
> On Oct 22, 6:02 pm, Henner Zeller <henner.zel...@googlemail.com>
> wrote:
>> On Fri, Oct 22, 2010 at 15:01, Paul <mjpabl...@gmail.com> wrote:
>> > Hi,
>>
>> > This may seem like a basic question, but I find having to label
>> > the .proto file with unique tag numbers for each field a little
>> > cumbersome, especially if there are a lot of fields.
>>
>> > message Person {
>> >  required string name = 1;
>> >  required int32 id = 2;
>> >  optional string email = 3;
>> > }
>>
>> > Can I define a .proto file without the tag numbers, like so?
>>
>> > message Person {
>> >  required string name;
>> >  required int32 id;
>> >  optional string email;
>> > }
>>
>> No.
>>
>> The reason for this explicit definition is that the protocol buffer is
>> 'future compatible': fields written with a particular tag will always
>> be written with that tag. Consider you want to re-structure the fields
>> in your proto buffer to say (Id, name, email) ... then they would get
>> a different 'automatic' tag assigned and you wouldn't be able to read
>> files written with older binaries. If the tags are assigned, then
>> re-arranging fields in the file does not matter.
>>
>> -h
>>
>>
>>
>>
>>
>> > Thanks,
>> > Paul
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Protocol Buffers" group.
>> > To post to this group, send email to proto...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > protobuf+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/protobuf?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to 
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to