emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: empty-directory predicate, native implementation


From: Eli Zaretskii
Subject: Re: empty-directory predicate, native implementation
Date: Sun, 18 Oct 2020 05:47:45 +0300

> Date: Sat, 17 Oct 2020 13:03:35 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> 
> I don't understand why we would do this.  Is the
> real aim to be able to have an empty-directory
> predicate, i.e., to be able to see if there are
> no files in a directory?

It could be useful to know that a directory has at least N files in
it, and the complexity of stopping a loop after N iterations is the
same as stopping after 1 iteration.

> If so, then why not do just that, witout
> bothering (changing the signature of)
> `directory-files'?

The signature got an additional optional argument, which is backward
compatible.  And it is now trivial to implement the predicate for an
empty directory based on the modified directory-files.

> And what is the order that defines which file
> is first, second, etc.?  Without knowing that,
> what use is getting the "first" N?

As discussed: on some filesystems the order is known in advance.  Not
sure how important that is.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]