<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>prettyclose</title>
  <link>http://prettyclose.livejournal.com/</link>
  <description>prettyclose - LiveJournal.com</description>
  <lastBuildDate>Mon, 01 Jan 2007 18:05:37 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>prettyclose</lj:journal>
  <lj:journalid>11938574</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <atom10:link rel='hub' href='http://pubsubhubbub.appspot.com/' />
  <image>
    <url>http://l-userpic.livejournal.com/56467241/11938574</url>
    <title>prettyclose</title>
    <link>http://prettyclose.livejournal.com/</link>
    <width>100</width>
    <height>28</height>
  </image>

<item>
  <guid isPermaLink='true'>http://prettyclose.livejournal.com/543.html</guid>
  <pubDate>Mon, 01 Jan 2007 18:05:37 GMT</pubDate>
  <title>OPEN, CLOSE and :SUPERSEDE</title>
  <link>http://prettyclose.livejournal.com/543.html</link>
  <description>The current implementation of (open ... :if-exists :supersede) in CMUCL (and SBCL) is arguably wrong, especially when considering (close ... :abort t).&lt;br /&gt;&lt;br /&gt;I suggest we rename the file being opened to a temporary file name, generated by appending (symbol-name (gensym &quot;SUPERSEDED-&quot;)) to the file-type (to make the risk of collisions smaller; to be a little more certain, PROBE-FILE it, as well).&lt;br /&gt;&lt;br /&gt;Aside from that, what :rename-and-delete currently does is the closest fit that is possible and useful on a regular unix fs, to the best of my knowledge and understanding.&lt;br /&gt;&lt;br /&gt;The current behaviour of :supersede (open and truncate) via O_TRUNC is useful, though, so I suggest an extension with the name :truncate (since there is no other way to do that, with just OPEN and standard args).&lt;br /&gt;&lt;br /&gt;This is how some different options to OPEN currently work in CMUCL (and, I think, SBCL, except for versions) for &quot;standard streams&quot; (fd-streams):&lt;br /&gt;&lt;br /&gt;:if-exists -- note that this is only used if :direction is :io or :output, otherwise ignored&lt;br /&gt;&lt;br /&gt;- :error -- Signals an error if the file exists. New, empty file, at position 0.&lt;br /&gt;open() &amp;lt;- O_EXCL&lt;br /&gt;&lt;br /&gt;- :new-version -- If the file exists, use the Emacs version stuff; that is, the newest version is &quot;foo.lisp&quot;, the first version is &quot;foo.lisp.~1~&quot;, and so on. Find the highest-                  numbered version, and rename the current file to that+1, and create a new file. New, empty file, at position 0.&lt;br /&gt;open() -&amp;gt; O_CREAT&lt;br /&gt;&lt;br /&gt;- :rename -- Rename the current file to &quot;filename.BAK&quot;, and create a new file. If (close ... :abort t) is called, undo the renaming. If &quot;filename.BAK&quot; exists, overwrite it.&lt;br /&gt;open() &amp;lt;- O_CREAT&lt;br /&gt;&lt;br /&gt;- :rename-and-delete -- As above, except after a non-abort CLOSE, delete the renamed file. New, empty file, at position 0.&lt;br /&gt;open () &amp;lt;- O_CREAT&lt;br /&gt;&lt;br /&gt;- :overwrite -- Open the current file, at position 0.&lt;br /&gt;No truncation, no open() flags.&lt;br /&gt;&lt;br /&gt;- :append -- Open the current file, at file-position end-of-file.&lt;br /&gt;No truncation, no open() flags.&lt;br /&gt;&lt;br /&gt;- :supersede -- Open the current file, truncated, at position 0. &lt;br /&gt;open() &amp;lt;- O_TRUNC&lt;br /&gt;&lt;br /&gt;- nil -- Return nil. No opening occurs.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;Note that this behaviour of :if-exists :supersede, which I consider wrong, appears to be the same in the current versions of CMUCL, SBCL, Allegro CL, LispWorks, CLISP, GCL, and ECL on my machine, 2006-12-30.</description>
  <comments>http://prettyclose.livejournal.com/543.html</comments>
  <category>cmucl</category>
  <category>lisp</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
</channel>
</rss>
