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

]Link.Create #andys should error (note: no characters between "#" and "andys") #269

Closed dyaandys closed 3 years ago

dyaandys commented 3 years ago
  ]Link.Create #andys

Linked: # → /home/andys/#andys

Leaving me with the rather nastily named directory '#andys' .. think that expression should error as it should have 2 arguments.

  ]version

Dyalog 18.1.40612 64-bit Unicode, BuildID f71cd074 OS Linux 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 Link 2.1.0-beta88 SALT 2.9 UCMD 2.5 .NET WS 18.1

dyaandys commented 3 years ago

As Kai pointed out to me, you can have great fun by passing 'ASTERISKandys' or 'andysASTERISK' as the single argument .. be careful getting rid of the resulting directory :-)

nicolas-dyalog commented 3 years ago

A - The first behaviour is correct : A1 - The namespace is unspecified to it defaults to current namespace which is # A2 - All that is specified is the directory name "#andys", and so ]link.create does what it's told If you expect UCMDs to parse APL, and scan "#" separately from "andys" in "#andys", then we need to redesign the whole UCMD framework which assumes that space is the argument separator.

B - Can you describe the exact repro, what goes wrong, and what you would have expected as a result ? My understanding of your sarcastic description of the problem is to attempt to do "]link.create andys*", which correctly fails for me on windows, and correctly succeeds on linux.

aplteam commented 3 years ago

Then the help needs polishing. The only indicator that it may be called with just one argument is this:

Syntax: 1-2 arguments (last arguments merged) 

And because the help lists <ns>as the first, one would assume that the second one (the directory) is optional. Which is most probably the reason why Andy drew the conclusion that Create requires two arguments.

And BTW what last arguments merged means is a mystery to me.

abrudz commented 3 years ago

IIRC, we decided to assume # for the single-argument case, only for the user command. Maybe indeed that was a bad shortcut. Should we roll it back?

last arguments merged means that you can have (single) spaces in the last argument, and they won't be treated as separate arguments. Useful when the last argument is a path which may contain spaces.

On Thu, Jun 3, 2021 at 3:02 PM APL Team Ltd @.***> wrote:

Then the help needs polishing. The only indicator that it may be called with just one argument is this:

Syntax: 1-2 arguments (last arguments merged)

And because the help lists as the first, one would assume that the second one (the directory) is optional. Which is most probably the reason why Andy drew the conclusion that Create requires two arguments.

And BTW what last arguments merged means is a mystery to me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Dyalog/link/issues/269#issuecomment-853894056, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTUEE4B4RVF6VVSJFLSWODTQ6DQVANCNFSM454H2MYA .

mkromberg commented 3 years ago

I don't remember the discussions. Apparently we disallow it in the API function and in hindsight it certainly seems like a bad idea to allow it in the user command.

]link.create should require two arguments.

nicolas-dyalog commented 3 years ago

Reverted Q6 of #136. Fixed in link v2.1.0-beta92