-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Currently, all structs defined in a Slice1 file must be marked compact. I am proposing to remove this requirement and make the compact qualifier optional in Slice1.
Slice1 structs are always compact since the Slice1 encoding doesn't allow tagged fields in structs.
On the other hand, a Slice2 struct is non-compact by default, which means: you can define right away a tagged field, or add one later, without breaking on-the-wire compatibility.
You may want to make such a Slice2 struct compact when (and only when) it's a small struct with no tagged fields that you transmit in large quantity, and you want to save one byte per instance in its encoded representation. Needless to say, compact struct should be uncommon.
For example, say you're porting an Ice application to IceRPC, as a first step, you convert your .ice definitions into Slice1 .slice definitions. You're getting interface, classes, compact structs, enums...
The compact structs are not great because if you later convert these definitions to Slice2, you may keep all these compacts, even though compact should be very rare. And in this scenario, you loose the ability to later extend these converted structs in a wire-compatible manner.