Skip to content

Restrictions

The following restrictions apply to dfns and/or dops:

  • A dfn does not need to return a result. However, any expression that does not produce a result still terminates the dfn. This means that you cannot call a no-result function from the middle of a dfn and expect to continue after the dfn has been evaluated, as evaluation stops at that expression.
  • Normal tracing (command code ) steps over a single-line dfn, executing it atomically like an execute () expression. This deliberate restriction avoids the confusion of tracing a line and seeing nothing change. Inline tracing (command code ) can step through the functions called within a single-line dfn, and a multi-line dfn traces normally.
  • ⎕CS is not supported inside a dfn; attempting to call it generates a NONCE ERROR.
  • ⎕MONITOR, ⎕TRACE, and ⎕LOCK do not apply to dfns or dops.
  • ⎕SHADOW skips dfns when looking down the stack for a tradfn in which to make a new local name.
  • Control structures and other :-keywords, such as :If and :Return, cannot be used within a dfn. Instead, a dfn expresses conditions through guards.
  • Monadic branch ( given a line number, equivalent to :GoTo) is not supported. Niladic branch, that is abort (), does work: it clears the most recently suspended statement and all of its pendent statements from the state indicator.
  • Modified assignment (X f←Y) and use of the pass-through value of an assignment (that is, X f Y←Z) behave as expected when f is a primitive. However, in a dfn a named function is instead read as part of a multiple assignment, so X plus←10 assigns 10 to both X and plus. Instead, modified assignment can be achieved by inserting ∘⊢, that is, by using X plus∘⊢←10, and pass-through can be achieved by using 1 plus∘⊢a←10 or 1 plus⊢a←10.