Are there any streams for which FILE-POSITION is required not to
return NIL when called with one argument? In particular, what are the
odds that FILE-POSITION will work well with string input streams?
One resonable interpretation of http://clhs.lisp.se/Body/f_file_p.htm
is that
(defun file-position (stream &optional position-spec)
nil)
is a perfectly acceptable implementation, which would mean that it's
quite useless in portable code.
Lars Brinkhoff <·········@nocrew.org> writes:
> Are there any streams for which FILE-POSITION is required not to
> return NIL when called with one argument? In particular, what are the
> odds that FILE-POSITION will work well with string input streams?
>
> One resonable interpretation of http://clhs.lisp.se/Body/f_file_p.htm
> is that
>
> (defun file-position (stream &optional position-spec)
> nil)
>
> is a perfectly acceptable implementation, which would mean that it's
> quite useless in portable code.
Even in C, some programs can't work when you provide them a pipe
instead of file, because they can't seek or get the size of the "file"
or the current position.
(if (file-position stream)
(can-work-with-this stream)
(cannot-work-with-this stream))
--
__Pascal Bourguignon__ http://www.informatimago.com/
"A TRUE Klingon warrior does not comment his code!"
Pascal Bourguignon <···@informatimago.com> writes:
> Lars Brinkhoff <·········@nocrew.org> writes:
>> Are there any streams for which FILE-POSITION is required not to
>> return NIL when called with one argument?
>
> Even in C, some programs can't work when you provide them a pipe
> instead of file, because they can't seek or get the size of the
> "file" or the current position.
Sure, but it seems you shouldn't expect FILE-POSITION to always work
with, say, FILE-STREAMs.
On Fri, 28 Jul 2006 22:50:14 +0200, Lars Brinkhoff <·········@nocrew.org> wrote:
> Are there any streams for which FILE-POSITION is required not to
> return NIL when called with one argument? In particular, what are the
> odds that FILE-POSITION will work well with string input streams?
>
> One resonable interpretation of http://clhs.lisp.se/Body/f_file_p.htm
> is that
>
> (defun file-position (stream &optional position-spec)
> nil)
>
> is a perfectly acceptable implementation, which would mean that it's
> quite useless in portable code.
And the following is a perfectly acceptable implementation of EVAL:
(defun eval (foo)
(error "Memory exhausted"))
So what?
<Insert here usual lesson about quality of implementation>
P.
--
Anything below this line is being added by the newsserver