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: Arthur Miller
Subject: Re: empty-directory predicate, native implementation
Date: Sat, 17 Oct 2020 23:58:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Drew Adams <drew.adams@oracle.com> writes:

>> > Sorry I'm coming to this late.  It's a long thread,
>> > and I've only checked your patch, not the messages.
>> >
>> > 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?
>>
>> I would just like to add to the previous mail; that this optimisation
>> really does not matter on very first call...
>
> Believe me, I'm not trying to second-guess any
> implementation.  I haven't (and won't) look at the
> C code, and I'm not very qualified to do so anyway.
>
> I was guessing that COUNT = 1 would be quicker for an
> emptiness check than COUNT > 1 (e.g. COUNT = 80000).
>
> But my argument wasn't about implementation or
> efficiency.  Even if, for some reason, C had to "get"
> (info about) all of the files in the directory, just
> to determine whether the dir is empty, my argument
> would be the same wrt Lisp: have a separate predicate,
> or have a Boolean new parameter, instead of having a
> COUNT new parameter.
I am not sure I follow; but it is a building block to build that
predicate. I agree with you that it is much nice to have such predicate
built-in than if anyone is building their own if it is just one liner.

I have no problems to build that predicate on directory_files_internal
either, it is trivial; and it would remove need to change the function
signature and count confusion, but than instead of changing one
parameter in a signature it would be a new predicate in Lisp
implementation. Wold be nice exercise to me to learn how to write
a tramp handler :-), but I am not sure it is desired.

Don't know, what Michael and Eli have to say about?



reply via email to

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