Nominal Subtyping vs. Structural Subtyping

Months = 0..12

MonthsClass = Class Months
    name self =
        match self:
            1 -> "january"
            2 -> "february"
            3 -> "march"

MonthsImpl = Patch Months
    name self =
        match self:
            1 -> "January"
            2 -> "February"
            3 -> "March"

assert 12 in Months
assert == "February"
assert not 12 in MonthsClass
assert in MonthsClass
# It can use structural types, even though wrapped in a class.
assert in Months
# If both exist, class methods take priority.
assert == "february"

In The End, Which Should I Use, NST or SST?

If you cannot decide which one to use, our recommendation is NST. SST requires abstraction skills to write code that does not break down in any use case. Good abstraction can lead to high productivity, but wrong abstraction (commonality by appearances) can lead to counterproductive results. (NSTs can reduce this risk by deliberately keeping abstraction to a minimum. If you are not a library implementor, it is not a bad idea to code only with NSTs.