Skip to content

backward-compatible thrown exception #1

Description

@sduwall

first version zs content:

package tutorial;

struct Employee
{
    uint8           age : age <= 65; // max age is 65
    string          name;
    uint16          salary;
    Role            role;
    // if employee is a developer, list programming skill
    Experience      skills[] if role == Role.DEVELOPER;
};

struct Experience
{
    bit:6       yearsOfExperience;
    Language    programmingLanguage;
};

enum bit:2 Language
{
    CPP     = 0,
    JAVA    = 1,
    PYTHON  = 2,
    JS      = 3
};

enum uint8 Role
{
    DEVELOPER = 0,
    TEAM_LEAD = 1,
    CTO       = 2
};

struct ArrayEmployee
{
    int16   numItems;
    Employee list[numItems];
};

second version zs content:


struct Employee
{
    uint8           age : age <= 65; // max age is 65
    string          name;
    uint16          salary;
    Role            role;
    // if employee is a developer, list programming skill
    Experience      skills[] if role == Role.DEVELOPER;

    optional uint16 bonus;
};

struct Experience
{
    bit:6       yearsOfExperience;
    Language    programmingLanguage;
};

enum bit:2 Language
{
    CPP     = 0,
    JAVA    = 1,
    PYTHON  = 2,
    JS      = 3
};

enum uint8 Role
{
    DEVELOPER = 0,
    TEAM_LEAD = 1,
    CTO       = 2
};

struct ArrayEmployee
{
    int16   numItems;
    Employee list[numItems];
};

problem description:

  1. serialize array employee used second version zs
  2. deserialize array employee used first version zs
  3. raise zserio.PythonRuntimeException
  4. How to solve the problem?
  5. How to keep backward-compatible?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions