Huangyan9188 / gogoprotobuf

Automatically exported from code.google.com/p/gogoprotobuf
Other
0 stars 0 forks source link

default #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Write tests with gogoprototest and generated nullable, marshalling, 
unmarshalling and size code to create deterministic behaviour.

Original issue reported on code.google.com by awalterschulze on 8 Oct 2013 at 3:29

GoogleCodeExporter commented 9 years ago
gogoprototests are done.

Making default values illegal for non-nullable fields might fix all my issues.
http://code.google.com/p/gogoprotobuf/source/detail?r=321219d70bc26ad10c2ada5d14
8ea122473f4ac3

I should also make sure fieldpath works with defaults.

Original comment by awalterschulze on 1 Nov 2013 at 6:56

GoogleCodeExporter commented 9 years ago
I reverted changes which will make default and nullable work together

http://code.google.com/p/gogoprotobuf/source/detail?r=53f1868722b1474411bf22f1cc
69cd4a3b73f0b6

I see potential problems when unmarshalMerge comes around and and the default 
values override the already set values.
With non-nullable fields it is "hard" to tell if they have been set before.

I finally understand this

"Project Member #5 dsymo...@golang.org:
Protocol buffers specify that it is possible to distinguish between a
field being set and a field having its default value, as bizarre as
that may seem. Thus a plain value is not sufficient representation,
and we decided that pointers were the least of the possible evils.
" - http://code.google.com/p/goprotobuf/issues/detail?id=29&can=1

I would rather not make nullable more popular than it needs to be.
So if it means that nullable has limited use cases this is good thing.

Original comment by awalterschulze on 1 Nov 2013 at 7:04

GoogleCodeExporter commented 9 years ago
This eliminated all of the problems I could see, except fieldpath

http://code.google.com/p/gogoprotobuf/source/detail?r=96cc1417d78d7a5e57fa659342
fe9d6332761e0b

Original comment by awalterschulze on 1 Nov 2013 at 7:58

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/gogoprotobuf/source/detail?r=a2cbb9e3ce8ab9e350516a3cda
5da7b61f926853

Finally fixed

Original comment by awalterschulze on 1 Nov 2013 at 1:22