Dyalog SALT.Load exceptions "could not fix" for raw function trains

76 Views Asked by At

I've been experimenting with SALT but am encountering consistent Load problems that seem to only affect raw function-trains. I hoped for any advice on ensuring all functions Load correctly.

To illustrate, in a clear workspace I'll create some example functions for converting hex and octal. Some are dfns, others are raw trains:

FromOct←8⊥⊢
ToOct←(FromOct⍣¯1)
FromHex←{16⊥⍵}
ToHex←{((16⊥⊢)⍣¯1)⍵}
HexToOct←ToOct FromHex

Initial salt state:
⎕SE.SALT.List '/path/to/salt'
Type Name Versions Size Last Update

Then Snap the workspace:
⎕SE.SALT.Snap '/path/to/salt -clean -loadfn'

** WARNING: ⎕LX is empty
 #.FromHex  #.FromOct  #.HexToOct  #.ToHex  #.ToOct 

⎕SE.SALT.List '/path/to/salt -type'

 Type  Name      Versions  Size  Last Update         
 Fn    FromHex               25  2021/05/18 17:08:32 
 Fn    FromOct               25  2021/05/18 17:08:32 
 Fn    HexToOct              46  2021/05/18 17:08:32 
 Fn    ToHex                 36  2021/05/18 17:08:32 
 Fn    ToOct                 31  2021/05/18 17:08:32 
 Fn    load_ws              537  2021/05/18 17:08:32 

And check what the load_ws function is importing:
⎕CMD 'cat /path/to/salt/load_ws.dyalog | grep "^ Load''"'

 Load'"/path/to/salt/FromHex" -target=#'       â #.FromHex
 Load'"/path/to/salt/FromOct" -target=#'       â #.FromOct
 Load'"/path/to/salt/HexToOct" -target=#'      â #.HexToOct
 Load'"/path/to/salt/ToHex" -target=#'         â #.ToHex
 Load'"/path/to/salt/ToOct" -target=#'         â #.ToOct

In a clear workspace, run the load_ws:
⎕SE.SALT.Load '/path/to/salt/load_ws'
load_ws

*** could not fix "/path/to/salt/FromOct.dyalog"
*** could not fix "/path/to/salt/HexToOct.dyalog"
*** could not fix "/path/to/salt/ToOct.dyalog"

The dfns load fine, the trains fail.
A ready workaround is to wrap with tradfns or dfns, but this is very undesirable.

Any thoughts on getting SALT to Load these kind of functions correctly?
Thanks

1

There are 1 best solutions below

3
On BEST ANSWER

As per the current SALT User Guide:

Nameclasses 3.3 (primitive or derived function) and 4.3 (primitive or derived operator) cannot be manipulated using SALT – attempting to do so can result in a loss of data.

As mentioned in Paul Mansour's comment, Dyalog Ltd. recommends transitioning from SALT to Link, especially when using Dyalog APL version 18.1, due to be released in the upcoming months. However, note that even Link does not currently handle tacit functions:

Functions, operators and namespaces without text source (⎕NC of 3.3 or 4.3, namely derived functions/operators, trains and named primitives), are not supported.

As opposed to SALT, which is not scheduled to receive any major feature additions, this is likely to change in the near future.

While it is awkward to wrap tacit functions in tradfns by hand, the “Lazy” library makes this a breeze.