Re: [protobuf] Scala protocol buffers protoc plugin

2010-09-07 Thread Jason Hsueh
Default values for required fields do mean that: use the default if not explicitly set. This only affects the in-memory object, though - IsInitialized() will still fail if a required field is not set. However, such a proto would be usable by a client that does not do required field checking by

Re: [protobuf] Scala protocol buffers protoc plugin

2010-09-04 Thread Chris Kuklewicz
Required fields having an explicit default do not affect serialization but may affect how a language instantiates a message. I wrote the Haskell version of protocol-buffers. And I used the Maybe type constructor for optional fields. When serializing this means all Nothing fields can be

Re: [protobuf] Scala protocol buffers protoc plugin

2010-08-24 Thread Kenton Varda
On Wed, Aug 18, 2010 at 7:07 AM, Jeff Plaisance jeffplaisa...@gmail.comwrote: It seems like the issue here is that optional has been overloaded to mean two different things: 1) Not really optional but in order to do rolling upgrades we're making it optional. The default should be used if it

Re: [protobuf] Scala protocol buffers protoc plugin

2010-08-18 Thread Kenton Varda
All fields have default values. If no default is defined in the file, then the default is zero/empty. So, hasX() only tells you whether or not the field was explicitly set -- not whether or not it has a value (it always does). I understand that you might have a difference of taste here, but

Re: [protobuf] Scala protocol buffers protoc plugin

2010-08-17 Thread Jeff Plaisance
I agree that defaults should be handled in the library. I have been putting off the issue because i found the interaction between the hasX and getX methods confusing when a default is specified. hasX returns false if x isn't explicitly set, but getX may or may not return a valid value anyway

[protobuf] Scala protocol buffers protoc plugin

2010-08-11 Thread Jeff Plaisance
Hello, I have written a compiler plugin that generates type safe scala wrappers for the java protoc output. It creates wrappers for each message type that use the scala Option type for all optional values. It also forces all required parameters to be included in the constructor of the builder so

Re: [protobuf] Scala protocol buffers protoc plugin

2010-08-11 Thread Jason Hsueh
Added to the wiki, thanks! On Wed, Aug 11, 2010 at 12:57 AM, Jeff Plaisance jeffplaisa...@gmail.comwrote: Hello, I have written a compiler plugin that generates type safe scala wrappers for the java protoc output. It creates wrappers for each message type that use the scala Option type for