Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic versioning for PIG type universes #121

Open
dlurton opened this issue May 13, 2022 · 1 comment
Open

Semantic versioning for PIG type universes #121

dlurton opened this issue May 13, 2022 · 1 comment

Comments

@dlurton
Copy link
Member

dlurton commented May 13, 2022

PIG domains could be given semantic versioning to help with identifying their persisted instances.

Example:

// universe_version is the proposed addition
(universe_version  { major: 1, minor: 2 ))

// calcluator_ast is just an example domain for clarity.
(define calculator_ast
    (domain
        (sum operator (plus) (minus) (times) (divide) (modulo))
        (sum expr 
            (lit value::int)
            (binary op::operator left::expr right::expr)
        )
    )
)

When converted to s-expressions, they might look like this:

(tree
  { domain: calculator_ast, major: 1, minor: 2 } 
  (lit 42)
)

universe_version and the tree s-expression wrapper being the new things here. The version would apply to all domains in the type domain since changing one domain can impact any domain that permutes from it.

This helps us to deal with some of the challenges that arise when loading data from an older type universe into a newer generated domain.

When the s-expressions are created by the generated code, they must be wrapped in a tree node with the same version numbers as the type universe file it was generated from. When converting back from s-expressions, the generated code must ensure that the major version is the same and that the minor version is equal or less than the same in the type universe file. The only caveat is that the major and minor versions must be manually maintained--and we'll have to consider carefully if the changes we make should be a major or minor version bump.

@lziq
Copy link
Contributor

lziq commented May 16, 2022

For the version number, I would recommend defining it at the top of the PIG type universe file to indicate that it belongs to all the permuted PIG domains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants