On 19 Nov 2002 at 12:00, CBFalconer wrote:
This particular error is **very** hard to detect at run-time in any efficient manner.
I'm not sure I understand this. Is it not a matter of checking, before each component access, whether the variant selector (or selectors) is in the range of the corresponding case-constant-list? Isn't that a simple range check, e.g., equivalent to that performed before an assignment?
It is even impossible if the variant selector is not stored....
Well, yes, but I don't see why that would prevent implementation in the case where it was stored. In the latter case, it should be possible at run time to verify before access that the selector is set to a proper value.
...I am not willing to give up the freedom of variant records with no selector element.
There's no question here of "giving up freedom," as the standard requires that the tag-field be optional. But I do not see anything in the standard that requires that such checking be "all or nothing," i.e., must cover all possible cases or none of them. If some errors are detected and others are not, that appears to be perfectly in line with the requirements of ISO 10206.
-- Dave