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

`Expunge` returns an inconsistant/wrong result #507

Open aplteam opened 1 year ago

aplteam commented 1 year ago

Expunge pretends to be a cover function that can be called instead of ⎕EX, but it does not return the same result as ⎕EX does.

⎕EX returns a 1 for a name that is now available. It does not report success or failure of the delete operation:

      a←1
      ⊢⎕EX 'a'
1
      ⊢⎕EX 'a'
1
     ⊢⎕EX '1a'
0

The Expunge function does not say anything about its result but from the code I can tell that it attempts (at least in one place) to report success:

:If 0=nc
    r[i]←0
    :Continue
:EndIf

But it does not do that consistently, see #506 ("Expunge does not deal correctly with ## and the likes").

Expected behaviour

Either return the same result as ⎕EX or (my preference) return an indicator that the delete was successfully performed on the file because deleting it from the WS should always succeed anyway.

Returning the same result as ⎕EX does seem to be pretty pointless: I was never able to put this to good use in decades. Also, hardly anybody knows what the result of ⎕EX actually means.