That would have many of the same problems as inheritance.

How about instead fixing your XML and JSON formatting code to support
flattening during encoding?  You could trigger it based on a custom option,
so you'd end up with:

  extend google.protobuf.FieldOptions {
    optional bool inherit = 54321;
  }

  message SomeType {
    optional BaseType base = 1 [(inherit)=true];
    ...
  }

The "inherit" option would be recognized by the XML and JSON encoders, but
wouldn't make any difference otherwise.

On Tue, Sep 14, 2010 at 5:34 PM, Eric Hauser <ewhau...@gmail.com> wrote:

> Hi,
>
> We have a lot of definitions that have a number of repetitive
> properties, but we would like to keep the object definition flat (i.e.
> no field called base containing the base fields).  The reason is that
> the definition may end up getting copied to another object where
> inheritance is not an issue or serialized to another format (JSON or
> XML) where it also makes sense to not have a nested field.
>
> I would like to do something like have 'option clone = "some/other/
> proto.proto"' where the fields would get cloned from another object.
> Just curious if anyone has done anything like this.
>
> Thanks.
>
> --
> 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<protobuf%2bunsubscr...@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