Faré,
I like the portable getenv implementation - Not having that available is why my proposal uses a logical pathname so that one can define the temporary directory easily from the outside.
Then again, I'm not sure that Alexandria should include loads of implementation specific switches. It might then be better to combine a cross-implementation getenv and the temporary file handling stuff into a trivial-temporary-file library and let Quicklisp do the rest.
-Hans
2012/4/22 Faré fahree@gmail.com:
On Sun, Apr 22, 2012 at 09:35, Hans Hübner hans.huebner@gmail.com wrote:
Hi,
following up on an IRC discussion yesterday, I am proposing the addition of the OPEN-TEMPORARY function and WITH-OPEN-TEMPORARY-FILE macro below (and on http://paste.lisp.org/display/129090#14). It implements functionality that is commonly required, but that is not available in any other library in a portable fashion. osicat has been suggested, but it does not implement temporary file handling on Windows.
This posting is to determine whether there is opposition regarding inclusion in Alexandria. I'll re-post as a proper patch including symbol exports when there is agreement to include it.
xcvb-driver includes a with-temporary-file facility that does more than your proposed code, including support for open or closed temporary files (and if open, with proper element-type and external-format), binding or not binding the pathname, decent defaults for a temporary directory on Windows and RMCL (but not genera), and whether to keep the file or not outside the body.
The main missing feature is proper umask settings on Unix, or at least a hook for such settings to be added on top. That means that the feature cannot be used where security matters, or the underlying call-with-temporary-file function must be wholly replaced.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Have the courage to take your own thoughts seriously, for they will shape you. — Albert Einstein