[protobuf] Extensions in Java

2010-07-27 Thread Wouter
Hello, I am basically following the approach described under Union Types in the techniques section of the documentation. I am using extensions. I have found that when deserialising protobuffers in Java it does not automatically deserialise the extensions. I have to manually create a registry (I am

[protobuf] Issue 207 in protobuf: python: MergeFrom copies fields not actually present

2010-07-27 Thread protobuf
Status: New Owner: ken...@google.com Labels: Type-Defect Priority-Medium New issue 207 by kleptog: python: MergeFrom copies fields not actually present http://code.google.com/p/protobuf/issues/detail?id=207 What steps will reproduce the problem? 1. Create the following protocol in test.proto

[protobuf] Issue 208 in protobuf: python: constructor does not type check scalar values

2010-07-27 Thread protobuf
Status: New Owner: ken...@google.com Labels: Type-Defect Priority-Medium New issue 208 by kleptog: python: constructor does not type check scalar values http://code.google.com/p/protobuf/issues/detail?id=208 What steps will reproduce the problem? 1. Create a simple protocol file, such as (tes

[protobuf] Re: Issue 208 in protobuf: python: constructor does not type check scalar values

2010-07-27 Thread protobuf
Comment #1 on issue 208 by kleptog: python: constructor does not type check scalar values http://code.google.com/p/protobuf/issues/detail?id=208 Sorry, that last line should ofcourse be: etattr(self, field_name, field_value) -- You received this message because you are subscribed t

[protobuf] Re: Issue 208 in protobuf: python: constructor does not type check scalar values

2010-07-27 Thread protobuf
Comment #2 on issue 208 by kleptog: python: constructor does not type check scalar values http://code.google.com/p/protobuf/issues/detail?id=208 Attached is a patch which fixes the above. While testing this locally I found that it revealed problems in the test suite where fields that weren

[protobuf] Re: Issue 207 in protobuf: python: MergeFrom copies fields not actually present

2010-07-27 Thread protobuf
Comment #1 on issue 207 by kleptog: python: MergeFrom copies fields not actually present http://code.google.com/p/protobuf/issues/detail?id=207 Attached is a patch which does the above and fixes the issue for me. Attachments: mergefrom.patch 480 bytes -- You received this message b

Re: [protobuf] Extensions in Java

2010-07-27 Thread Jason Hsueh
The C++ implementation does have a singleton registry, which allows it to magically parse extensions that are linked into the binary. This behavior can be somewhat confusing though since it relies on what the linker decides to do with generated code. The Java implementation uses an object oriented

Re: [protobuf] Re: FileDescriptorSet mania

2010-07-27 Thread Kenton Varda
On Mon, Jul 26, 2010 at 2:09 PM, yy wrote: > > DynamicMessage thisthing= DynamicMessage.parseFrom( > myDescriptorProto.getDescriptorForType(), inputM); > thisthing.writeTo(System.out); > This writes raw binary to System.out. Use System.out.print(thisthi

Re: [protobuf] Inserting into a RepeatedCompositeFieldContainer

2010-07-27 Thread Kenton Varda
Sorry, that's currently the only solution. This isn't easy in C++ or Python either -- it's an unusual use case. On Thu, Jul 22, 2010 at 7:48 PM, Chung wrote: > Hi all, > > In the Python API, I'd like to insert a message in the middle of a > repeated message field. The only way I see for now is

Re: [protobuf] Building FileDescriptorSet out of FileDescriptor

2010-07-27 Thread Kenton Varda
Right, depth-first post-order *is* a (reverse) topological sort, which is what we're looking for here. On Thu, Jul 22, 2010 at 8:42 AM, Jason Hsueh wrote: > The "outbound edge" in the topological sort is from dependency to > dependent. This provides the guarantee that a file dependency will appe

Re: [protobuf] Re: Best practice to parse extensions in c++

2010-07-27 Thread Kenton Varda
On Tue, Jul 20, 2010 at 11:10 PM, Johan Philips wrote: > > > On 21 jul, 00:22, Kenton Varda wrote: > > IMO you should just include a tag field which contains some unique > > identifier, as described in the docs you cite. > > So I just shouldn't have used your extensions mechanism but rather > add

Re: [protobuf] FieldNumber constants

2010-07-27 Thread Kenton Varda
Consider the case where you define a message Foo in foo.proto, and then you extend it in bar.proto. When generating code for foo.proto, protoc doesn't necessarily know anything about bar.proto, so how could it generate anything based on the extensions defined there? Instead, extensions are genera

[protobuf] Re: Issue 207 in protobuf: python: MergeFrom copies fields not actually present

2010-07-27 Thread protobuf
Updates: Status: Fixed Labels: FixedIn-2.3.1 Comment #2 on issue 207 by ken...@google.com: python: MergeFrom copies fields not actually present http://code.google.com/p/protobuf/issues/detail?id=207 Thanks for the very clear bug report and patch. I ended up fixing this slight

Re: [protobuf] Re: Self describing messages

2010-07-27 Thread Kenton Varda
On Mon, Jul 26, 2010 at 7:54 AM, David wrote: > I don't want to send the whole enchilada on the wire - just the > descriptor for the message being sent. > The "whole enchilada" is needed if your message refers to any other message types. If not, you can just build a dummy FileDescriptorProto co

[protobuf] Re: Issue 208 in protobuf: python: constructor does not type check scalar values

2010-07-27 Thread protobuf
Comment #3 on issue 208 by ken...@google.com: python: constructor does not type check scalar values http://code.google.com/p/protobuf/issues/detail?id=208 Another great bug report, thanks. Fixed in revision 336. Testing revealed that the same problem existed for nested messages, since Mer

[protobuf] Re: Issue 208 in protobuf: python: constructor does not type check scalar values

2010-07-27 Thread protobuf
Updates: Status: Fixed Labels: FixedIn-2.3.1 Comment #4 on issue 208 by ken...@google.com: python: constructor does not type check scalar values http://code.google.com/p/protobuf/issues/detail?id=208 (No comment was entered for this change.) -- You received this message becau

[protobuf] Re: Issue 187 in protobuf: Command-line argument to override the "optimize_for" option

2010-07-27 Thread protobuf
Comment #11 on issue 187 by ken...@google.com: Command-line argument to override the "optimize_for" option http://code.google.com/p/protobuf/issues/detail?id=187 Hi all, Attached is a little protoc plugin written in Python which converts all the inputs to LITE_RUNTIME -- including renaming

[protobuf] Re: Issue 187 in protobuf: Command-line argument to override the "optimize_for" option

2010-07-27 Thread protobuf
Comment #12 on issue 187 by ken...@google.com: Command-line argument to override the "optimize_for" option http://code.google.com/p/protobuf/issues/detail?id=187 s/code code/core code/ s/retains/remains/ *sigh* -- You received this message because you are subscribed to the Google Groups "P

[protobuf] Re: Best practice to parse extensions in c++

2010-07-27 Thread Johan Philips
On 27 jul, 22:22, Kenton Varda wrote: > > I agree, but we don't have a good API for querying which extension is set. >  We might fix that someday by introducing language-level support for > "unions". Ok. So my struggle to find this API is more or less justified :-) > > for each defined extensi