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

Support "Voldemort" types for common structures (e.g. key/value mappings) #5

Closed
ascjones opened this issue Apr 1, 2020 · 1 comment
Milestone

Comments

@ascjones
Copy link
Contributor

ascjones commented Apr 1, 2020

Following up on #3, required before cutting a 0.1 release. From @Robbepop #3 (comment)

I was having a chat with @jacogr and we had the idea to conceptualize certain common structures in the generated JSON SCALE info.
For example we conceptualize the structure of mapping types.
A mapping type encodes as a sequence over some other type that has a key and value field. That's it. Below you can see the JSON that could conceptualize such a scenario concretely. Note that it might be nice to have so-called Voldemord composites that do not have a name since it isn't needed here. We just generate the type at index 1 upon serialization and will never need its name.

{
    names: [
        "BTreeMap", # ID: 1
        "KeyValue", # ID: 2
        "K",        # ID: 3,
        "V",        # ID: 4,
        "key",      # ID: 5,
        "value",    # ID: 6,
    ]
    types: [
        { # ID: 1
            composite: {
                path: [ 2 ], # We actually don't need this.
                             # Could we define composite types without names?
                             # Does that make sense at all? It would be similar
                             # to the concept of Voldemord types.
                fields: [
                    { name: 5, type: 4 },
                    { name: 6, type: 5 },
                ]
            }
        },
        { # ID: 2
            sequence: {
                type: 1
            }
        },
        { # ID: 3
            composite: {
                path: [ 1 ],
                params: [ 4, 5 ],
                fields: [
                    type: 2
                ]
            }
        },
        ...
    ],
}
@ascjones ascjones mentioned this issue Apr 1, 2020
8 tasks
@ascjones ascjones added this to the v0.1 milestone Apr 1, 2020
@ascjones ascjones changed the title Conceptualize common structures (e.g. key/value mappings) Support "Voldermort" types for common structures (e.g. key/value mappings) Apr 1, 2020
@ascjones ascjones changed the title Support "Voldermort" types for common structures (e.g. key/value mappings) Support "Voldemort" types for common structures (e.g. key/value mappings) Apr 3, 2020
@ascjones
Copy link
Contributor Author

Closed by #13

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

1 participant