You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original idea of enumerated types is to name some constants of an underlying type and treat these as cases of a new nominal type.
enumStatus: Int{On=1Off=0}letx: Status=Status.Onlety: Status=0// errorx+1// allowed because the `: Int` annotation publicizes the relationship
We could also generalize this so that constructors can not range over single values but whole sets of values, possibly filtered by a predicate (for when we have logical refinement types).
(This is different from the way recent languages use enum to define brand new nominal ADTs, which seems like a misappropriation of the original concept/name, probably from the original sin of Java's enum classes.)
The text was updated successfully, but these errors were encountered:
The original idea of enumerated types is to name some constants of an underlying type and treat these as cases of a new nominal type.
We could also generalize this so that constructors can not range over single values but whole sets of values, possibly filtered by a predicate (for when we have logical refinement types).
(This is different from the way recent languages use
enum
to define brand new nominal ADTs, which seems like a misappropriation of the original concept/name, probably from the original sin of Java'senum
classes.)The text was updated successfully, but these errors were encountered: