Tuesday, May 2, 2023

Re: surprising glob() result on Windows

> Just out of curiosity, I tried the same with python and tcl. Neither
> returns multiple files for the *.abc case so their behavior is
> different. I don't know why it differs but I would argue that their
> outputs do a better job of "meeting expectations".

That depends on what your expectations are. If you list a directory and
see a file "some~1.abc" then a glob() with *.abc should find it, right?
Or not? The question is whether you expect to match the long name only.

Usually when we encounter something where it's not 100% clear what the
right behavior is, the best choice is to leave it alone. The people who
are happy with the current behavior won't make any remark right now,
thus we have no idea how many we would "hurt" by making a change.

> Perhaps this is an issue I should raise with the vim developers for the
> following reasons. First, the Windows outputs are inconsistent with the
> linux outputs for the same directory contents.

Still, there have been no complaints until now. It appears to be more a
theoretical problem than a practical one.

Adding an optional argument to glob() to avoid the short filenames is
not a good idea, there already are three optional arguments. We could
change this to use a second argument that is a dictionary with the
current options plus the new one. It would be clearer when reading back
the function call. Is it really worth making this change?

> Second, it appears that vim is using this glob capability when
> sourcing plugins (I first noticed this using packadd) and so unwanted
> files could be sourced on Windows systems.

Can you be more specific about "when sourcing plugins" ?
Are there really files using an extension starting with ".vim"?

--
Team-building exercises come in many forms but they all trace their roots back
to the prison system. In your typical team-building exercise the employees
are subjected to a variety of unpleasant situations until they become either a
cohesive team or a ring of car jackers.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230502195340.586011C0C46%40moolenaar.net.

No comments: