The parser does not support sum-types (C++'s std::variants, Rust enums, ...), but it may be helpful to support them. How would a definition look like?
json Foo {
// ...
sum name {
variant type="Bar" {
key "a"
}
variant type="Baz" {
key "b"
}
}
}
Ideas
- Calling it
enum overloads the terms used for int-enum and str-enum, I would make it completely different (like the sum, which is closer to algebraic/type-theory).
- A sum-type variant must not contain
optional #true. All elements must be equally possible.
- Nesting
sum inside sum should not be possible (just make a new type).
The parser does not support sum-types (C++'s
std::variants, Rustenums, ...), but it may be helpful to support them. How would a definition look like?Ideas
enumoverloads the terms used forint-enumandstr-enum, I would make it completely different (like thesum, which is closer to algebraic/type-theory).optional #true. All elements must be equally possible.suminsidesumshould not be possible (just make a new type).