Skip to content

Drop Support for Preserving the 'Payload's of Unknown Variants #4331

@InsertCreativityHere

Description

@InsertCreativityHere

For variant enums marked unchecked, we allow decoding the values of "unknown enumerators",
and when we do, we stuff it's data into a special Unknown enumerator which looks something like this:

public partial record class Unknown
{
    int Discriminant,
    global::System.ReadOnlyMemory<byte> Fields,
}

I propose we remove the 'Fields' property from it.

  1. We don't preserve the bytes from tags that we skip, and we recognized all of our old preserve-slicing logic as not useful. I don't see why the bytes of unknown enumerators is different.
  2. Either:
  • The receiver has no idea what this discriminant is => these bytes are useful to them
  • The receiver knows this discriminant => the correct fix is to add this enumerator to your Slice definitions

There is no case where these bytes can be useful, except for forwarding them along. But I find this very niche.


It is easy to add this preservation back in the future in case we reverse course, or someone wants it.

Metadata

Metadata

Assignees

Labels

code generatorsproposalProposal for a new feature or significant update

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions