Currently, destruction is done via this pattern
match Hey
case Hey ! =>
end
the variant
match Hey
case Hey =>
end
only works for values of type cexp . Is the destruction pattern necessary? Shouldn't the first variant vanish and just leave the second variant on the table ? A counter argument is when doing type definitions:
typedef suit Diamonds, Spades, Hearts, Clubs
This would then not only match actual cexps, but everything that corresponds to the destructors Diamonds, ... That's usually NOT what you want. On the other hand, the following typedef would be OK (but more tedious to write down):
typedef suit Diamonds = Diamonds, Spades = Spades, Hearts = Hearts, Clubs = Clubs
There should be a more elegant way to deal with all these things.
Currently, destruction is done via this pattern
the variant
only works for values of type cexp . Is the destruction pattern necessary? Shouldn't the first variant vanish and just leave the second variant on the table ? A counter argument is when doing type definitions:
This would then not only match actual cexps, but everything that corresponds to the destructors Diamonds, ... That's usually NOT what you want. On the other hand, the following typedef would be OK (but more tedious to write down):
typedef suit Diamonds = Diamonds, Spades = Spades, Hearts = Hearts, Clubs = Clubs
There should be a more elegant way to deal with all these things.