Digest #271 2024-07-29

Contributions

[352] 2024-07-28 17:17:53 ruv wrote:

requestClarification - Unspecified ambiguous condition in /STRING

The specification says that u.2 is u.1 minus n.

If n is greater than u.1, the result of subtraction is wrapped around, and the resulting ( c-addr.2 u.2 ) cannot not be interpreted as a character string. Is it correct?

I think, either behavior (or maybe meaning) should be specified, or an ambiguous condition should be explicitly declared for this case.

Thus, I see the following options:

  • change the result stack parameter data type to ( c-addr.2 n.2 ) and describe what these parameters mean if n.2 is negative;
    • then, the input stack parameter data type should be changed to ( c-addr.1 +n.1 n ), and /string will not be applicable to character strings longer than max-n;
  • specify that if n is greater than u.1, it is replaced by u.1;
  • declare that an ambiguous condition exists if n is greater than u.1;
  • specify that if n is greater than u.1, an exception is thrown.

It seems, the last option is preferable. What do you think?