I-Beams in Dyalog APL
Overview
This section adds more detail to the I-Beam functionality that has been added to Dyalog APL 12.1.
As ever, please remember the caveat that appears in the Language Guide:
Warning: Although documentation is provided for I-Beam functions, any service provided using I-Beam should be considered as “experimental” and subject to change – without notice - from one release to the next. Any use of I-Beams in applications should therefore be carefully isolated in cover-functions that can be adjusted if necessary.
200: Syntax Colouring
The Language Reference details the use of 200⌶ with function or operator definitions:
200⌶ ⎕NR'foo'
However, this I-Beam has been extended to include Namespaces, Classes and Interfaces, using the following syntax:
200⌶ (⎕src object) type
where type is one of the following:
Value |
Object type |
1 |
Function (use ⎕nr) |
256 |
Namespace |
512 |
Interface |
1024 |
Class |
Since any vector of character vectors could be passed to 200⌶, the type is used to indicate to the interpreter what it should base its analysis on. So, for example if you run
200⌶(⎕src mynamespace) 1
then the namespace-specific tags will appear as 243 - "Mismatched control structure"; you can't have a :Namespace in a function definition !
Whereas if you run
200⌶(⎕src mynamespace) 256
then the :Namespace element will appear as a valid one (177).
The attached file lists all of the syntactic colour elements. Note that this list is very version-specific; this list was generated on 2009-11-20 for V12.1, and may be extended, reduced or removed altogether in future versions.