Skip to content

Clarify of in the case-endcase control-flow structure #22

@ruv

Description

@ruv

At the moment, the following types are specified for the compilation semantics for the words of case-endcase control structure:

  • Compilation case ( C: -- case-sys )
  • Compilation of ( C: -- of-sys )
  • Compilation endof ( C: case-sys of-sys -- case-sys )
  • Compilation endcase ( C: case-sys -- )

A consequence of these types is that the compilation semantics of of is effectively of type ( C: case-sys -- case-sys of-sys ), because it is impossible to write a standard program in which the of compilation semantics don't have a case-sys value at the top of the control flow stack. See also the comment [r1472] by Anton Ertl on 2025-08-02.

So, it makes sense to specify the of compilation semantics type as ( C: case-sys -- case-sys of-sys ).


Note that the same data type symbol in two different positions of a stack diagram does not imply the same value in the corresponding positions of the actual input/output parameters. This only means the same data type of the corresponding parameters. The indices of data type symbols in stack diagrams have no formal meaning (see 2.2.2 Stack notation and my comment [r1496]).

For example, ( n -- n ) means that a signed single-cell integer is taken and returned. This diagram does not indicate whether the actual output parameter is equal to the actual input parameter or not.

For implementation-dependent data types, the different values of the type may take different number of cells on the stack;

  • e.g., ( C: case-sys of-sys -- case-sys ), — the size of the actual output parameter of case-sys may differ from the size of the actual input parameter of case-sys (see also [r737]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions