Solving ambiguities with type enumerations
The following example introduces an ambiguity: blue is both a field in a struct and the value in an enum. We need to have some way to disambiguate
type sky_color: [blue, grey]
struct weather:
blue: int
sky: sky_color with:
keep (it == blue.as(sky_color))
We don't want to use the same syntax 'as' for this scoping concern rather than type casting.
We wish to disambiguate between two different enums with values with the same name in their scope is done with type inference
An alternative way to handle this is via namespaces and scoping and the Namespace section will examine this issue, e.g. it could look like this (syntax of course just for discussion purposes):
type sky_color: [blue, grey]
struct weather:
blue: int
sky: sky_color with:
keep (it == sky_color::blue) # Here it is the enum literal
keep (it == blue) # Here it is the field blue of struct wheather