
24 Jun
2005
24 Jun
'05
9:38 a.m.
Christian Maeder
voidcast v@(VariantWithOne{}) = v { field1 = Void , field2 = Void }
Setting field2 only assures type correctness, but the value of field2 would be ignored at runtime.
Exactly what I was proposing.
I could write a single expression that updated all possible variants of a type, simply by unioning all their possible labels.
I want to detect errors as early as possible.
But you can already write this:
voidcast v@(VariantWithOne{}) = v { field1 = Void , field2 = Void }
and you do not get a compile time error - it is a runtime error. I am proposing that it should not be thought of as an error at all. Regards, Malcolm