Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-11 Thread Kenton Varda
On Fri, Mar 10, 2017 at 3:29 AM, Sam Duke wrote: > Is it not that case that displaying or using default values as if they are > truth is not always appropriate/safe? > IMO, it's not the server's job to verify that the message sent by the client is really exactly what the client intended. Sure, t

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-10 Thread Sam Duke
Great points and prompting some more philosophical thought :) Sam On Fri, 10 Mar 2017 at 03:09 Kenton Varda wrote: > On Thu, Mar 9, 2017 at 1:03 PM, Sam Duke wrote: > > I find that many cases where I at first think I need field presence > actually make more sense as a union -- I find that, sur

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Kenton Varda
On Thu, Mar 9, 2017 at 1:03 PM, Sam Duke wrote: > Thanks so much for the reply Kenton :) I've inlined as you've covered a lot > > On Thursday, 9 March 2017 20:49:49 UTC, Kenton Varda wrote: >> >> Hi Sam, >> >> Ross mostly covered this, but I'll give an official response as the >> author: >> >> Ca

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Sam Duke
Suddenly the generics come into their own! great idea :) On Thursday, 9 March 2017 20:45:25 UTC, Ian Denhardt wrote: > > Ideally the boilerplate could be cut down by having a standard type > like: > > struct Option(T) { > union { > Some @0 :T; > None @1 :Vo

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Sam Duke
Thanks so much for the reply Kenton :) I've inlined as you've covered a lot On Thursday, 9 March 2017 20:49:49 UTC, Kenton Varda wrote: > > Hi Sam, > > Ross mostly covered this, but I'll give an official response as the author: > > Cap'n Proto has "presence", including hasX() accessors, for pointe

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Kenton Varda
Hi Sam, Ross mostly covered this, but I'll give an official response as the author: Cap'n Proto has "presence", including hasX() accessors, for pointer types (structs, lists, text, data; anything that is variable-size) but not for primitives (integers, floats, bools). The feature was not "remove

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Ian Denhardt
Ideally the boilerplate could be cut down by having a standard type like: struct Option(T) { union { Some @0 :T; None @1 :Void; } } And then just do: struct Foo { age @0 :Option(Int32); } But the wire format doesn't really do what

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Ross Light
No worries. I'm not an official member of the Cap'n Proto project; I just work on the Go bindings. You are correct that oneof is similar to unions in Cap'n Proto. Yeah, if you need an out-of-band signaling that a particular field is set or not, then you can either use a union or wrap the field i

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Sam Duke
I think the idea of an unset sentinel value is a little awkward as it conflates data validation with field presence which are nice concepts to keep separate (in part for consistency in how you perform data validation). As I understand it a union is synonymous to a Protobuf oneof field? Is the rec

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Ross Light
Quite the opposite: it's so that scalar values always have a fixed offset from the beginning of the struct's data section. This may waste space on the wire, but makes scalar access consistent and avoids branches in the common case (read as fast). However, it's worth noting that reading a scalar f

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Sam Duke
Really confused why this was removed? Is it for less space on the wire? Field presence seems an excellent way to guard against regression as protos evolve. On Thu, 9 Mar 2017, 18:20 Ross Light, wrote: > Correct. In this respect, Cap'n Proto is very close to proto3 semantics. > > On Thu, Mar 9,

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Ross Light
Correct. In this respect, Cap'n Proto is very close to proto3 semantics. On Thu, Mar 9, 2017 at 10:08 AM Sam Duke wrote: > Looks like there's no hasX methods for scalars? > > On Thu, 9 Mar 2017, 15:57 Ross Light, wrote: > > https://capnproto.org/faq.html#how-do-i-make-a-field-optional > > On T

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Sam Duke
Looks like there's no hasX methods for scalars? On Thu, 9 Mar 2017, 15:57 Ross Light, wrote: > https://capnproto.org/faq.html#how-do-i-make-a-field-optional > > On Thu, Mar 9, 2017, 4:01 AM wrote: > > I couldn't find an explicit mention of this on the website, curious if > CapNProto has also re

Re: [capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread Ross Light
https://capnproto.org/faq.html#how-do-i-make-a-field-optional On Thu, Mar 9, 2017, 4:01 AM wrote: > I couldn't find an explicit mention of this on the website, curious if > CapNProto has also removed field presence detection - it's a really useful > feature to have! > > -- > You received this me

[capnproto] Proto3 removed field presence detection, has CapNProto done the same?

2017-03-09 Thread samduke474
I couldn't find an explicit mention of this on the website, curious if CapNProto has also removed field presence detection - it's a really useful feature to have! -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group an