From: Lars Brinkhoff
Subject: FILE-POSITION useless?
Date: 
Message-ID: <85wt9xo3nd.fsf@junk.nocrew.org>
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.

From: Pascal Bourguignon
Subject: Re: FILE-POSITION useless?
Date: 
Message-ID: <87mzat1kuq.fsf@thalassa.informatimago.com>
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!"
From: Lars Brinkhoff
Subject: Re: FILE-POSITION useless?
Date: 
Message-ID: <85odv8op8p.fsf@junk.nocrew.org>
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.
From: Pierpaolo BERNARDI
Subject: Re: FILE-POSITION useless?
Date: 
Message-ID: <op.tdfgd9x0xbm8ci@eraora>
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