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. ⎕CSis not supported inside a dfn; attempting to call it generates aNONCE ERROR.⎕MONITOR,⎕TRACE, and⎕LOCKdo not apply to dfns or dops.⎕SHADOWskips dfns when looking down the stack for a tradfn in which to make a new local name.- Control structures and other
:-keywords, such as:Ifand: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 whenfis a primitive. However, in a dfn a named function is instead read as part of a multiple assignment, soX plus←10assigns10to bothXandplus. Instead, modified assignment can be achieved by inserting∘⊢, that is, by usingX plus∘⊢←10, and pass-through can be achieved by using1 plus∘⊢a←10or1 plus⊢a←10.