Re: Question about directory-files Lassi Kortela 31 Jul 2019 18:45 UTC

>>> In the description it says "If dir is not a directory, returns '()."
>>> I'm not sure that shouldn't always be an error
>
>> I Agree.
>
> ("I agree that it should always be an error", I interpret.)

Yes :)

> Thinking further, what if it's a directory, but you aren't allowed to
> search it?

That does happen in real life.

I think every kind of error when opening/reading/closing a directory
(i.e. anything for which there is an errno value) should cause an
exception in Lisp. The lenient version where (directory-files) returns
'() for a non-directory is probably again inspired by interactive use in
scsh. There are many cases where convenience in interactive use leads to
a design that is unfit for reliable programs in general.