[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: firstname.lastname@example.org
- Subject: Issue: DIRECTORY-DOES-TOO-MUCH
- From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Fri, 24 Mar 89 01:31 EST
- Cc: CL-Cleanup@SAIL.Stanford.EDU
- In-reply-to: <8903232306.AA26773@pitney-bowes>
I don't oppose your proposal, but I have some non-preemptive remarks
that you might want to consider factoring into a revision if you have
time to pursue the issue. (I really don't know how much I believe these
suggestions, but they occurred to me and I thought I would share them.)
- I think the name DIRECTORY-GENERATOR is a bit long
and not startlingly perspicuous.
- I think that returning a function means that some common
cases will seem unduly complicated because of the need to
FUNCALL the result to turn it into a useable form.
These are not fatal flaws, but they drive the following suggestions:
You might want an interface like
(DIRECTORY-1 pathname) => pathname-or-nil, function-or-nil
[Actually, it's clear that first return value has to be NIL.
The second return value doesn't have to be NIL -- it could be
a function which returns NIL when called, but people might want
to optimize that case.]
The name is by analogy with MACROEXPAND-1. You'd get a useful
primary value and some more-p information in the secondary value
that you could discard if you didn't want.
The really nice feature of the data flow is, of course, that you can
directly use the single return value without further fuss or funcall.
You might even want to allow it to taken an optional argument saying
you didn't want the second return value (i.e., that NIL was ok) to
(DIRECTORY-1 pathname NIL) => pathname-or-nil, nil
Alternatively, or additionally, you might want to think about
extending DIRECTORY to take a keyword requesting the indicated
(DIRECTORY pathname :COUNT 1)
might want to return just the first pathname, presumably as a list
to be compatible with the normal style of DIRECTORY, and to generalize
nicely to :COUNT arguments like 0 or 2.
If this were an alternative to DIRECTORY-1, it could also return a
second return value which was the stepper function (or NIL if none).
If this were just in addition to DIRECTORY-1, then it could arguably
not bother with the second return value and make you call DIRECTORY-1
if you needed that much power.