link
link copied to clipboard
How can I link into a non-empty root namespace with v. 3 as I did with v. 2 of Link.
Describe the bug I use Link with flatten option, hence link into root namespace. After upgrading to v. 3.0.19 of Link it is no longer possible to do in a non empty root namespace.
This is the reported message:
⎕SE.Link.Create: Cannot link a non-empty namespace to a non-empty directory:
I have noticed it was added to documentation, that only empty namespaces was allowed, but is this really what we want?
dir means that the namespace must be non-existent or empty and will be populated from source files.
To Reproduce
)clear
clear ws
'cetestopt'⎕ns''
cetestopt.flatten←1
cetestopt.typeExtensions←1 2 ⍴3 'aplf'
cetestopt.fastLoad←1
path←'c:\repos\tools-global-apl'
cetestopt ⎕SE.Link.Create '#' path
⎕SE.Link.Create: Cannot link a non-empty namespace to a non-empty directory: #.# ←→ c:\repos\tools-global-apl
cetestopt ⎕SE.Link.Create'#'path
∧
⎕se.Link.Version
3.0.19
Expected behaviour I expect to be able to link to root namespace also when it contains variables, functions, etc.
The actual use case is a situation, where I have workspace with an APL application loaded in root and want to include some additional functions to root namespace.
Session transcript See above.
Desktop (please complete the following information):
- OS: [Windows]
- APL version: [18.2.45345 Unicode 64-bit]
⎕SE.Link.Version: [3.0.19]
Additional context It seems to work even if root namespace isn't empty. I added a stop in line 44-45 and set emptyns.
cetestopt ⎕SE.Link.Create '#' path
Create[44]
)si
⎕SE.Link.Create[44]*
emptyns
0
emptyns←1
)si
⎕SE.Link.Create[45]*
→⎕LC ⍝
Linked: # ←→ c:\repos\tools-global-apl
This issue also prevents customising typeextensions. )clear mytypeext←1 2⍴ 3 'aplf' ]link.create # d:/temp/linktest -flatten -fastload -source=dir -typeextensions=mytypeext ERRORS ENCOUNTERED: ⎕SE.Link.Create: Destination namespace not empty: #
I have asked cenghoff this via email:
Can you achieve what you want with something like this?
]link.create # c:\repos\tools-global-apl -flatten -fastload -source=dir
The default for typeExtensions is Default: 6 2⍴2 'apla' 3 'aplf' 4 'aplo' 9.1 'apln' 9.4 'aplc' 9.5 'apli'
Is that OK for you?
The issue is not the typeExtension. It makes no difference if I use default or not. The problem at hand is, that if I already have some stuff in the root namespace, then I cannot create a link via flatten.
I imagine the flatten argument must be taken into consideration and if that one is set, then allow a "non-empty" root namespace. However I don't know if this introduces some unforeseen side effects.