Dyalog / link

Source code for Link – the built-in component that enables the use of text files as the primary storage mechanism for APL source code
https://dyalog.github.io/link
MIT License
19 stars 11 forks source link

Link’s Expunge completes the path when it shouldn’t #619

Closed aplteam closed 4 months ago

aplteam commented 6 months ago

Even when an object is specified by a full path does LINK attempt to complete the path.

That means that this:

      ⎕←⎕THIS
#.TEMP
      ⎕SE.Link.Expunge '#.Foo.Boo'

leads on line [9] to this:

      container
#.TEMP

That does not hurt because

#.TEMP.⎕EX '#.Foo.Boo'

would work as intended, but when Expunge is called from an instance of a class things are different, because this statement from line [15]:

(ns name)←container U.SplitNs i⊃names

assigns in my case #.Tester2.TestCases.[Tester2].#.TEMP to ns, and that leads to a crash on line [16]:

ns←⍎ns ⍝ resolve e.g. #.linkdemo.##

⎕SE.Link.U.SplitNs should ignore the left argument in case the right argument is fully qualified anyway.

This revised version of the fn would fix the problem:

SplitNs←{(~(1⍴⍵)∊'#⎕')∧0≠⎕NC'⍺':∇(⍕⍺),'.',⍵ ⋄ t←1+d←-'.'⍳⍨⌽⍵ ⋄ (d↓⍵)(t↑⍵)}

Desktop (please complete the following information):

]tooLS.Version
 Dyalog  19.0.48436 64-bit Unicode, BuildID 246567e8            
 OS      Windows 10 or Windows Server 2016 (10.0.19045) 64-bit  
 Link    4.0.12                                                 
 SALT    2.915                                                  
 UCMD    2.6                                                    
 .NET    .NET Framework 4.8.9181.0                              
 WS      19.0                                                   
 Tatin   0.103.1                                                
 Cider   0.38.0