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

Re: Issue: DIRECTORY-DOES-TOO-MUCH



> Date: Fri, 24 Mar 89 01:31 EST
> From: Kent M Pitman <KMP@stony-brook.scrc.symbolics.COM>
> Subject: Issue: DIRECTORY-DOES-TOO-MUCH
> To: jlm@lucid.COM
>
> 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.]
>
[...]
>
> 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
> avoid consing.
>
>  (DIRECTORY-1 pathname NIL) => pathname-or-nil, nil

Now that's a slippery slope.  If we start allowing functions to take an
optional argument telling them how many values {not} to return, where do
we stop?  In any case, it's the job of the compiler and its many optimizers,
in most cases, to determine when and if it is possible/feasible/desirable to
generate code that avoids returning unused values.  
 
Plus, which is more painful - a few extra conses, or the directory lookup
in the first place?  (Answer: implementation-dependent.)