On Wed, Aug 30, 2023 at 12:22 AM August Karlstrom <fusionfile@gmail.com> wrote:
1) For case statements with integer labels, which often represent an enumerated type, it's *desirable* to trap non-matching case expressions as it may indicate a forgotten case label.
2) When using case statements with type labels, the programmer typically relies on non-matching case expressions being ignored; for message records the message "fall through", as described in "Programming in Oberon", p. 61. Here it's *essential* that the implementation does not halt the program with a trap, otherwise this technique will not work.
The language report says:
"First the case expression is evaluated, then the statement sequence is executed whose case label list contains the obtained value."
As I interpret the sentence above, the expression is supposed to match exactly one label, however that is not the case with "fall through" messages. I think it needs to be clarified in the language report that "fall through" is well-defined for case statements with type labels. Any comments?
My interpretation is that the presence of the phrase *case label list* indicates that the remainder of the sentence only applies to numeric case statements. The syntax for type case statements is a substantially reduced form of the syntax for numeric case statements: TypeCaseStatement = CASE qualident OF case {"|" case} END. case = [qualident ":" StatementSequence]. NumericCaseStatement = CASE expression OF case {"|" case} END. case = [CaseLabelList ":" StatementSequence]. CaseLabelList = LabelRange {"," LabelRange}. LabelRange = label [".." label]. label = integer | string | qualident. -- Regards, Chris Burrows CFB Software https://www.astrobe.com