Edit Object {R}←{X}⎕ED Y
⎕ED invokes the Editor. Y is a simple character vector, a simple character matrix, or a vector of character vectors, containing the name(s) of objects to be edited.
The optional left argument X is a character scalar or character vector (where =/≢X Y) which specifies the type(s) of the corresponding (new) object(s) named in Y as:
∇ | function/operator |
→ | simple character vector |
∊ | vector of character vectors |
- | character matrix |
⍟ | Namespace script |
○ | Class script |
∘ | Interface |
⋄ | array: use array notation |
If Y names an existing object, the type specification for that name in X is ignored, unless X is ⋄.
If X is ⋄, Y must be undefined or an array. The Editor opens in array-notation mode; the resulting array can be of any type or structure.
If ⎕ED is called from the Session, it opens Edit windows for the object(s) named in Y and immediately returns a null result. The cursor is positioned in the first of the Edit windows opened by ⎕ED, but can be moved to the Session or to any other window that is currently open. The effect is almost identical to using )ED.
If ⎕ED is called from a defined function or operator, its behaviour is different. On asynchronous terminals, the Edit windows are automatically displayed in "full-screen" mode (ZOOMED). In all implementations, the user is restricted to those windows named in Y. The user cannot skip to the Session even though the Session might be visible. ⎕ED terminates and returns a result only when the user explicitly closes all the windows for the named objects. The result contains the names of any objects that have been newly (re)fixed in the workspace as a result of the ⎕ED, and has the same structure as Y.
Objects named in Y that cannot be edited are silently ignored. Objects qualified with a namespace path are (for example, a.b.c.foo) are silently ignored if the namespace does not exist.
Variant Options
⎕ED supports two variant options, ReadOnly and EditName, specified using the variant operator ⍠, summarised in Table 1, and described in detail beneath it. There is no principal option.
| Variant Option | Valid Values | Default | Effect |
|---|---|---|---|
ReadOnly | 0 or 1 | 0 | Whether the Edit windows are read-only. |
EditName | 'Default', 'Allow', or 'Disallow' | 'Default' | Whether the user can open further Edit windows by clicking a name. |
Variant Option: ReadOnly
If ReadOnly is set to 1, the Edit window and all Edit windows opened from it will be read-only. Setting ReadOnly to 0 will have no effect if the Edit window is inherently read-only due to the nature of its content.
Variant Option: EditName
The EditName variant option determines whether the user can open another Edit window by clicking a name. Its values are interpreted as follows:
EditName | ⎕ED called from session | ⎕ED called from function |
|---|---|---|
'Default' (default) | Allow | Disallow |
'Allow' | Allow | Allow |
'Disallow' | Disallow | Disallow |
Examples
A←3 11⍴'Hello World' In the first example, ⎕ED will display the contents of A as an editable character array which the user can change. The user can double-click on Hello to open an edit window on an object named Hello (which will be a new function if Hello is currently undefined). Furthermore, the user can enter any arbitrary name and double-click to edit it. This might be undesirable in an application.
⎕ED A In the second example, the Edit window will display the contents of A as a ReadOnly Character array. The user can still open a new edit by double-clicking Hello or World but nothing else.
(⎕ED ⍠ 'ReadOnly' 1) 'A' In the final example, the Edit window will display the contents of A as a ReadOnly Character array and the user cannot open a new edit window.
(⎕ED ⍠('ReadOnly' 1)('EditName' 'Disallow'))'A'