Open that-hatter opened 7 months ago
you can still display it as int. As all enum entries are Integer. imo. they should be used as types.
if you want to go really fancy and intend to confuse users, do something like this
IntExpression<E, Op> ::= E | IntExpression<E, Op> Op E
type: [ IntExpression<Location, Op.Pipe | Op.Plus> ]
I don't think it's a good idea to use enums as types then not display them as such. Sort of defeats the purpose.
I don't think it's a good idea to use enums as types then not display them as such. Sort of defeats the purpose.
I think it does make sense to display them as types which extend int to avoid your concern of confusion. You could create a type / extend the enum to allow for certain operations like '+' or '|' afaik, there's no enum that can be used in combination of a value defined in another enum. but if there is, it could be defined as new type combining the enums with allowed operations.
Should Enums be usable as Types? e.g.:
instead of using
int
and linking to the enum in the description:This means the signature of
Card.IsLocation
in the site would be displayed asCard.IsLocation(Card c, Location loc)
instead ofCard.IsLocation(Card c, int loc)
.Pros:
Cons:
LOCATION_
constants, e.g. LOCATION_MZONE|LOCATION_SZONE.