Issues when converting
From APL+Win to Dyalog APL
Primitives and syntax
-
For
(a a)←1 2APL+Win setsa←1but Dyalog setsa←2. This is hard to fix, but probably a rare occurrence. -
If both arguments are empty
,and⍪return their left argument in Dyalog but their right argument in APL+Win -
"-delimited character constants can be automatically transformed to use'quotes but⍎will fail on a'-delimited expression that contains"-delimited text. -
Pass-though value of modified assignment is the expression on the left in APL+Win but the expression on the right in Dyalog.
System constants
-
∆SYSVERlooks at the executable timestamp, but the interpreter does actually know when it was created, as shown in the About box -
⎕SINLcannot be modelled, but is unlikely to appear in code; use)SINL.
System variables
-
⎕RLnot fully modelled (missing two RNGs and∆RLis not updated when generating); only⎕RL←should be replaced with∆RL←. -
⎕PRis impossible to model. R is a character singleton or empty vector. If R is empty,⍞input is returned with the prompt included in the result, including any changes user has made. If R is a character, that character replaces each unmodified element of the prompt in the result.⎕PRhas no effect when⎕ARBOUT ⍳0is used. ⎕WATCHPOINTSwould be very nice to have
System functions
-
Dyadic
⎕DRis complex and does multiple advanced things, including data (de-)serialisation using binary or XML form. -
⎕CALLand⎕STPTRcannot be modelled, but is usually easy to rewrite to pure APL. -
Skipping
⎕DEFLfor now as not worth the effort, though totally doable. -
⎕IDLOCis hard (WIP) -
User commands are different, so
∆UCMDis unlikely to work as⎕UCMD -
∆INBUFisn't perfect, but it does allow basic things. -
∆CRLPCcannot read public comments from locked functions -
⎕LOGis part of the larger logging system. It writes timestamped and optionally (left arg) event-typed entries a log file. -
⎕CFINFOand⎕DTRare not implemented
Keywords
-
:Assert expris a comment at runtime, but an assertion when running in debug mode -
:Debug expris a comment at runtime, but an:if DEBUGMODE ⋄ {}…if in debug mode -
:Trace… is part of the larger logging system. It is skipped unless in test mode. It is equivalent to:IfTest ⋄ ⎕LOG…
Control structures
Conditionals
-
:Andand:Orare short-circuiting∧and∨like:AndIfand:OrIfbut for inline expressions, and:Exallows intermediary execution (like statements between:Ifand:AndIf/:OrIf) -
:IfTestis:If TESTMODE
Error Trapping
-
:Tryis:Trap 0 -
:TryAllis similar to the effect of setting ⎕ELX„'…⎕LC+1' but without the problems doing so could cause in called functions. -
Rather than
:Caseby error number, APL+Win has:CatchIf val≡⎕DM↑⍨¯1+⎕DM⍳⎕TCNLwhich can be abbreviated to:Catch val— I suggest we allow:Trap 'DOMAIN ERROR'and:Case 'DOMAIN ERROR'etc. -
:Testblock is part of the larger logging system. It is skipped unless in debug mode. The:Passblock requires all statements to work without error, while the:Failblock requires all statements to error.
Select
-
:NextCaseis the opposite ofbreakin C-like languages, i.e. where C continues the the next case, APL jumps to:EndSelectat the end of a:Caseblock, but:NextCaseallows continuation. The current substitution to→2+⎕LCfails if there are diamonds instead of line breaks. -
:Likeis like:Caseexcept it takes a globbing pattern and matches the selected-for value against this. IMO such:Selectstatements should be written as:If/:ElseIfwith an expression to do the matching.