On 8/22/16 Aug 22 -4:00 PM, Elias Pipping wrote:
On 22 Aug 2016, at 22:47, Robert Goldman rpgoldman@sift.net wrote:
ACL offers a functionality like this with its make-temp-file-name and make temp file.
I'd love to have a portable version that would, for example, make temporary files that could be used as arguments in RUN-PROGRAM.
Is there any reason this could not be exported?
Dear Robert,
get-temporary-file is just an a very simple wrapper around with-temporary-file, which is already exported. What you can e.g. already do(*) is use
(with-temporary-file … (%run-program :output … :wait t))
or
(with-temporary-file (… :keep t) (%run-program :output … :wait nil))
That’s a pretty nice interface, I find (the implementation is another matter). Do you find it too verbose?
I am translating some existing code that does something like the following:
concatenate f1 and f2 > temp file 1 concatenate f2 and f1 (i.e., reverse concat) > temp file 2 compute function of temp file 1 compute function of temp file 2 return minimum of f(temp file1), f(temp file2)
I did this using "cat" for which it is more convenient to have the name of the file than the stream.
In general, when invoking the shell, the shell "speaks" names, not CL streams.
Now, as you said, I could simply replicate the logic of GET-TEMPORARY-FILE, but since GET-TEMPORARY-FILE pretty much replicates the interface of mktemp, which the shell wizards consider to be valuable, I think there's precedent for something like GET-TEMPORARY-FILE being supplied. Although, perhaps calling it GET-TEMPORARY-FILENAME would be better.
Is there some reason it would be inappropriate to export this?
Best, r