Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-29 Thread Rob Pike
Look at the simple decoder in encoding/gob/debug.go. -rob On Wed, Jun 29, 2016 at 5:07 PM, Alex Flint wrote: > Sorry to keep bothering you folks with this but does anybody have an > answer to this? > > On Tue, Jun 21, 2016 at 9:26 AM Alex Flint wrote: > >> Oh I expected that since I only call

Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-29 Thread Alex Flint
Sorry to keep bothering you folks with this but does anybody have an answer to this? On Tue, Jun 21, 2016 at 9:26 AM Alex Flint wrote: > Oh I expected that since I only called encoder.Encode once, there would > only be on repetition of the outermost segment. I was expecting the > wireType to be

Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-21 Thread Alex Flint
Oh I expected that since I only called encoder.Encode once, there would only be on repetition of the outermost segment. I was expecting the wireType to be within the inner "(-type id, encoding of a wireType)*" segment. Otherwise shouldn't the spec be ((byteCount, -type id, encoding of a wireTy

Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-21 Thread Rob Pike
It's as advertised, 1 count byte (1a=26) followed by 26 bytes, followed by one count byte (5), followed by 5 bytes. Note the final '*' in that grammar. -rob On Tue, Jun 21, 2016 at 8:20 AM, Alex Flint wrote: > The gob docs state that a gob stream consists of > > (byteCount (-type id, encodi

[go-nuts] semantics of byteCount in gob encoding

2016-06-21 Thread Alex Flint
The gob docs state that a gob stream consists of (byteCount (-type id, encoding of a wireType)* (type id, encoding of a value))* I was expecting byteCount to be the number of bytes remaining in the entire packet, but that does not seem to be the case. For example when encoding a single instan