On Wed, Dec 11, 2019 at 2:37 PM Lassi Kortela <xxxxxx@lassi.io> wrote:
 
> In what sense?  It's glob(3) and much like other things at that level.

In the sense that it adds a lot of semantics on top of syscalls. While
something like read-directory is an abstraction, it's a fairly obvious
mapping of getdirentries(). Glob isn't an obvious mapping of any
syscall. If there was a glob in kernels, it would be a different matter.

GIven the presence of tempfiles, groups, and users (all completelyl justified IMO), that ship has sailed in SRFI 170.  In any case, Posix makes no distinctions (nor should it) between syscalls and library operations.

 That's why I think the syscall API is a better target to aim for.

Except that it is completely non-portable.   I tried intersecting Posix, Linux, and FreeBSD in a very early concept of this SRFI, and it was a mess.

IMHO if we're going all the way up to this level of abstraction, the
libc glob syntax is no longer the best one to use. We might as well
implement something like bash or zsh globs, and there is no universally
available C library for that.

I agree that a complex globber doesn't belong in SRFI 170.  But a simple globber (and I'm fine with calling it simple-glob) still handles a bunch of use cases.  In the shell I almost never use anything but *, ?, [...], and braces, and braces don't care about the state of the filesystem: you can just expand them before globbing.  All this except the braces has been around since the 7th Edition, although the glob library used to be part of the shell source.
 
That is a neat glob implementation. I don't quite understand the
parsing; it hardly seems to do any preprocessing to the pattern string.

I confess to not reading it.
 
I've several times found the Posix globs wanting for real work. Simple
jobs are not too bad to do by manually filtering and merging directory
listings; for complex jobs, Posix globs are not feature-rich enough.
Hence based on my experience I'd advocate for something more complex.

The best (especially when we don't have it yet) is the enemy of the good.  In the meantime, simple-glob will be easy to specify and easy to add.



John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
My corporate data's a mess!
It's all semi-structured, no less.
But I'll be carefree / Using XSLT
On an XML DBMS.