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 10 forks source link

If DYALOGSTARTUPSE does not refer to a folder containing Link, it will not be loaded #475

Closed mbaas2 closed 2 years ago

mbaas2 commented 2 years ago

Describe the bug I'm working on a project that is independ of Link, but wants to use DYALOGSTARTUPSE. If I understand the doc correctly, this is not a problem and Link would be loaded from its default location.

To Reproduce

      +2⎕nq'.' 'GetEnvironment' 'DYALOGSTARTUPSE'    ⍝ check if empty: Link is loaded w/o setting DYALOGSTARTUPSE

      ⎕SE.SALT.Load'APLProcess'  
      t←(739⌶0),'/empty-',⎕D∩⍨⍕⎕TS                ⍝ create an empty folder
      a←⎕NEW APLProcess(''('DYALOGSTARTUPSE=',t))    ⍝ launch a new process

     ⍝ go into the session of the process and execute the command:
      ⎕se.UCMD'Link.Break #'

     ⍝ this creates the following output:
Link User Commands are incompatible with the installed version of Link
Link User Commands are incompatible with the installed version of Link

     ⍝ now try this:
      ⎕se.Link.Break #
VALUE ERROR: Undefined name: Link
      ⎕SE.Link.Break #
          ∧
     ⍝ so Link was NOT loaded into ⎕SE!

Expected behaviour Link should function normally and not be affected

Desktop (please complete the following information):

Dyalog 18.2.45573 64-bit Unicode, BuildID 90cda44a
OS Windows 10 or Windows Server 2016 (10.0.19044) 64-bit
SALT 2.9, Link: (unavailable)
UCMD 2.51
.NET .NET Core 3.1.24
WS 18.2

mkromberg commented 2 years ago

I think this should only happen if the version of Link being loaded is very old, i.e. v2. Can you check what is in the folder that is being referenced?

mbaas2 commented 2 years ago

I think you misunderstood: the DYALOGSTARTUPSE that I'm passing in this simple repro is empty. That was sufficient to build the repro. So I am expecting %DYALOG%\StartupSession\Link to be loaded...

abrudz commented 2 years ago

Version 19.0 will special-case Link rather than loading like like any other code per DYALOGSTARTUPSE.

mkromberg commented 2 years ago

I did indeed misunderstand the problem, and I think it is worse than what you reported, you will also disable the Array serialisation and a couple of other things if you do not point to a folder that contains the Dyalog-supplied code. Can you provide a link to the documentation that suggests this "is not a problem"?

lstefano71 commented 2 years ago

I am not Michael but I think I understand his concern. Let's look together at what the manual has to say about DYALOGSTARTUPSE: http://help.dyalog.com/18.2/#UserGuide/Installation%20and%20Configuration/Configuration%20Parameters/DyalogStartupSE.htm?Highlight=dyalogstartupse You ask to find a place in the documentation that says that if you don't point DYALOGSTARTUPSE to a folder containing Dyalog-supplied code "it is not a problem". I'd invert the question: where in the documentation does it say that if DYALOGSTARTUPSE points to a folder that does NOT contain Dyalog-supplied code it is a problem? If it's a problem then the documentation should say so because at this point in time there are a lot of dependencies on Dyalog's standard startup sequence (Hooks and friends) none of which is documented. I understand that you'd want to reserve the right to change everything without breaking everybody's assumptions, but as things stand people are already assuming things work in a certain way by reverse-engineering undocumented behaviours. It's their fault if things break, but that won't quench their thirst for vengeance when it happens :)

lstefano71 commented 2 years ago

Let's put it another way: Dyalog is implementing standard features using publicly documented extension points, which effectively makes said extension points unavailable for other usages. This is confusing and makes the extension points much less useful in practice.

mkromberg commented 2 years ago

I think this is a LITTLE bit harsh, if you follow the link to the "implementation", you can see that we did try to explain exactly how it works, and states that "In effect, this means that user-supplied content can replace content supplied by Dyalog Ltd.". I agree that there should have been more of a warning on the "front page", and that the text could be clearer in explaining that if you set DYALOGSTARTUPSE, you need to take care that the Dyalog code is still included. As Adam points out, this will all be reworked for v19.0 and one of the key goals is to completely separate "user" from "Dyalog" initialisation of the session.

mbaas2 commented 2 years ago

Thanks Stefano, for jumping in. My special concern was that Link was loaded magically with an empty DYALOGSTARTUPSE - but when a value was set, this overrrode ALL that is usually done via StartupSession. But anyway, my code no longer uses DYALOGSTARTUPSE and with it being addressed anyway with v19, I think this issue can be closed.