Re: [capnproto] Evolving the protocol to remove stale fields

2019-11-20 Thread 'Kenton Varda' via Cap'n Proto
Yes, in Cap'n Proto, fields take space regardless of whether or not they've been "set". This is because fields are identified by their offset from the start of the struct, not by tags, which is what makes efficient zero-copy random access possible. Unset fields are always encoded as zeros on the wi

Re: [capnproto] Evolving the protocol to remove stale fields

2019-11-20 Thread Vitali Lovich
Thanks Ian and Kenton. That's very helpful. For the unused wire space, is that still true for AnyPointer fields that aren't set? On Wed, Nov 20, 2019 at 1:02 PM Kenton Varda wrote: > Hi Vitali, > > In general, the way we "remove" fields is by renaming them to add the > prefix "obsolete". As Ian

Re: [capnproto] Evolving the protocol to remove stale fields

2019-11-20 Thread 'Kenton Varda' via Cap'n Proto
Hi Vitali, In general, the way we "remove" fields is by renaming them to add the prefix "obsolete". As Ian points out, you can also change any pointer type to AnyPointer, and enum types to UInt16, to allow you to delete the referenced type definition. This does leave unused space in your messages

Re: [capnproto] Evolving the protocol to remove stale fields

2019-11-20 Thread Ian Denhardt
If it's a pointer type (structs, lists, interfaces), you can change the field's type to AnyPointer without affecting layout, which will let you delete the unused type definition. Other than that there's not really support for this; you'll see obsoleteFoo and deprecatedFoo in other codebases and af

[capnproto] Evolving the protocol to remove stale fields

2019-11-20 Thread Vitali Lovich
Hi, What's the equivalent process to removing a protobuf field in capnproto? In protobuf you could just delete it but for capnproto it looks like not only does it have to stick around so do it's type definition? So something like: Struct Foo { deprecatedField @0 :Bar } Means I have to keep t