guppylang
guppylang copied to clipboard
Parse enum definitions
Add a decorator @guppy.enum that parses a python class into a EnumDef.
Come up with syntax for struct enum variants. Maybe something like this:
@guppy.enum
class MyEnum:
Variant1 = {
"a": int,
"b": Qubit
}
Variant2 = {}
...
Blocked by #160
Could we have anonymous variants,
Variant3 = (int, float)
?
Notes:
- If one variant of an enum contains a linear field, the whole enum becomes linear
- We should probably unify enums and structs as some ADT type internally