Re: Is READ-LINE required to return a fresh string?



On Aug 27, 2:27 pm, Rainer Joswig <jos...@xxxxxxx> wrote:
In article <871w0atbat....@xxxxxxxxx>,
Richard M Kreuter <kreu...@xxxxxxxxx> wrote:

Hi,

I don't think I see anything in the READ-LINE specification that
requires the first return value to be a fresh string. Does anybody
else see such a requirement? (Otherwise, are conforming programs
supposed to copy any line they want to modify or hold on to?)

I also can't see it specified.

But I would expect CL:READ-LINE to return a fresh string
on each call.

I think this has to be considered the default in Lisp. In order for
it to be allowable for a function that returns some object to reuse an
object it previously returned, the specification would have to say so
explicitly. Hmm, I see the CLHS is not particularly consistent: the
page for CONS says "creates a fresh cons", and those for MAKE-ARRAY
and MAKE-INSTANCE say "creates and returns ..."; but that for LIST
simply says "returns a list containing the supplied objects", and
similarly the MAKE-STRING page just says "returns...". Still, there's
no doubt that for LIST or MAKE-STRING to reuse a previously returned
list or string would be completely bizarre.

-- Scott
.