On Thu, Jan 1, 2009 at 5:59 AM, Juan Jose Garcia-Ripoll <span dir="ltr"><<a href="mailto:juanjose.garciaripoll@googlemail.com">juanjose.garciaripoll@googlemail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
[CC of a message from comp.lang.lisp]<br>
<br>
Given the following piece of code, which behavior do you find more<br>
correct of the ones shown below?<br>
Is this simply undefined? I found the section on streams in the ANSI<br>
specification to be, say, lacking in all aspects, hehe.<br>
<br>
This is SBCL 1.0.10, an implementation of ANSI Common Lisp.<br>
"abcdefghijk"<br>
(0 #\a 1 NIL 0 #\x 1 #\a 2 #\b)<br>
"abxdefghijk"<br>
<br>
ECL (Embeddable Common-Lisp) 8.12.0 (CVS 2008-07-12 18:54)<br>
"abcdefghijk"<br>
(0 #\a 1 NIL 1 #\x 2 #\a 2 #\c)<br>
"axcdefghijk"<br>
<br>
Welcome to GNU CLISP 2.45 (2008-04-04) <<a href="http://clisp.cons.org/" target="_blank">http://clisp.cons.org/</a>><br>
"abcdefghijk"<br>
(0 #\a 1 NIL 0 #\x 1 #\a 2 #\c)<br>
"axcdefghijk"<br>
</blockquote><div><br>CCL agrees with SBCL and Clisp:<br>
<br>
"abcdefghijk" <br>
(0 #\a 1 NIL 0 #\x 1 #\a 2 #\c) <br>
"axcdefghijk" <br>
<br>My thinking is that ECL is wrong; Consider a bidirectional stream; what should write-char do after a unread-char? I think it should clobber the character read.<br><br>I do agree that ECL is currenly complying though; just that the current behavior is inconvenient. The standard's language on peek-char and unread-char makes it clear these don't have to interoperate, which indicates (to me) that nothough should be guaranteed about the file pointer.<br>
</div></div>