Question about UIOP: Any reason GET-TEMPORARY-FILE couldn't be exported?
fare at tunes.org
Tue Aug 23 00:13:27 UTC 2016
>> It's an unintentional omission indeed that
>> UIOP/STREAM::GET-TEMPORARY-FILE wasn't exported. I thought I had
>> exported it, but I failed to. The function has existed since 3.1.2
>> (i.e. the first stable 3.1 release).
> Since it has never been exported, I believe we can safely rename it. I
> note, actually, that my proposed renaming is also wrong. It should be
> GET-TEMPORARY-PATHNAME not FILENAME, right? Since we get back a CL
> pathname and not a namestring. At the expense of a slightly fatter
> interface, I'm tempted to add both:
> GET-TEMPORARY-PATHNAME returning a pathname and
> GET-TEMPORARY-FILENAME returning a filename (string)
I'm not opposed to renaming, but for some context, the
get-temporary-file was meant to contrast with a (hypothetical)
get-temporary-directory, just like mktemp and mkdtemp are related. I
never implemented the get-temporary-directory variant, because (1) the
use case didn't appear in asdf itself, (2) the function wasn't present
in the other lisp libraries I wanted to obsolete, and (3) the absence
of proper umask treatment by the Lisp variants.
Ideally, the Lisp variants would rely on mkostemps and mkdtemp and
similar interfaces, instead of reinventing the wheel, badly.
Unhappily, reinventing the wheel badly is all that we're allowed in
UIOP. For better portable interfaces, there is IOLib, but it requires
linking to a C library and various functions may or may not be
supported on Windows.
> The former is more natural for CL, but the latter is more useful when
> interacting with anything that is not CL.
>> Note that in most cases, you'll have cleaner code using
>> WITH-TEMPORARY-FILE, though (also to be considered debugged since
> Yes, I agree. For interop with the shell, though, this API may be handier.
As for pathname vs filename, I would use -namestring instead of
-filename; and then again, if it's for interacting with non-CL
software, you want a native-namestring, not a namestring (on platforms
that have such a concept). Returning a namestring in this context I
consider to be an attractive nuisance: people will use it because it's
handy, but it will do the wrong thing. I believe that's the reason I
didn't use the -pathname suffix: because it's the only sensible
interface that's not overly complicated and not an attractive
Note that inferior-shell (a layer on top of run-program) knows to
interpolate a CL pathname into a native-namestring, among other
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
[I]f we wish to count lines of code, we should not regard them as "lines
produced" but as "lines spent": the current conventional wisdom is so foolish
as to book that count on the wrong side of the ledger. — E. W. Dijkstra
More information about the asdf-devel