Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.lisp > #59350

Re: CLHS on *DEBUG-IO* and others

From Kaz Kylheku <433-929-6894@kylheku.com>
Newsgroups comp.lang.lisp
Subject Re: CLHS on *DEBUG-IO* and others
Date 2024-02-19 17:40 +0000
Organization A noiseless patient Spider
Message-ID <20240219092306.348@kylheku.com> (permalink)
References <6pd1+E7bUWxwHGM59@bongo-ra.co> <uqtv0o$1fckl$2@dont-email.me> <23FZrFyCKlaZfJP1R@bongo-ra.co>

Show all headers | View raw


On 2024-02-19, Spiros Bousbouras <spibou@gmail.com> wrote:
> On Sun, 18 Feb 2024 22:06:16 -0000 (UTC)
> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>> On Sat, 17 Feb 2024 14:08:29 -0000 (UTC), Spiros Bousbouras wrote:
>> 
>> > CLHS says
>> > 
>> >     Initial Value:
>> >     implementation-dependent, but it must be an open stream that is not
>> >     a generalized synonym stream to an I/O customization variables but
>> >     that might be a generalized synonym stream to the value of some I/O
>> >     customization variable.
>> > 
>> > This doesn't make sense.
>> 
>> It could if “an I/O customization variables” is a typo for “any I/O 
>> customization variables”. Note that *debug-io* is in the list of these 
>> variables in the glossary entry.
>> 
>> This is getting beyond my LISP-fu, but is “stream to a variable” distinct 
>> from “stream to the value of a variable”?
>
> Based on what the CLHS page for   System Class SYNONYM-STREAM   says ,
> I can't think of a meaningful distinction.

The glossary makes it clear. The principal meaning (1) of synonym
stream is that it's an object made by make-synonym-stream.

The target of a synonym stream is a dynamic variable name.

So if we call (make-synonym-stream '*standrad-output*) we get an
object that tracks the value of *standard-output*. If the value
of *standard-output* changes, that synonym stream becomes a
synonym to a different stream. (Note: in my dialet of English, I prefer
"synonym of" rather than "synonym to").

The Glossary also says that "synonym stream" has relative usages:
we can speak about a synonym stream to a symbol, and a synonym
stream to a stream.  The latter refers to the value of a symbol.
If S is a stream which is the current value of *standard-output*,
then our above object is a synonym to that stream (at the moment),
as well as a synonym to the *standard-output* symbol.

So then, what is this:

   implementation-dependent, but it must be an open stream that is not
   a generalized synonym stream to an I/O customization variables but
   that might be a generalized synonym stream to the value of some I/O
   customization variable.

It is saying that *debug-io* cannot be a synonym stream to another such
a variable.  For instance, *debug-io* will not be an object created
by (make-synonym-stream '*standard-output*). If we bind or assign
*standard-output*, *debug-io* must not change.

However, *debug-io* is allowed to be a synonym stream (thus necessarily
to some dynamic variable symbol), and that symbol can have the same
stream as *standard-output* as its initial value.

It looks like ANSI CL is trying to impose the requirement that those
stream variables are independent (not tied together as synonyms) without
imposing the requirement that they may not be generalized synonym
streams.

So this would be conforming:

  (defvar sys:internal-standard-ouptut ...)

  (defvar *debug-io* (make-synonym-stream 'sys:internal-standard-ouptut))
  (defvar *standard-output* (make-synonym-stream 'sys:internal-standard-ouptut))

Binding/assigning *debug-io* or *standard-ouptut* has no effect on
the other, but they are initially synonyms of
sys:internal-standrad-output, and so if that variable changes, they
both change.

This is allowed because sys:internal-standard-output is not one of the
public stream variables.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Back to comp.lang.lisp | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

CLHS on *DEBUG-IO* and others Spiros Bousbouras <spibou@gmail.com> - 2024-02-17 14:08 +0000
  Re: CLHS on *DEBUG-IO* and others Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-17 16:34 +0000
  Re: CLHS on *DEBUG-IO* and others Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-18 22:06 +0000
    Re: CLHS on *DEBUG-IO* and others Spiros Bousbouras <spibou@gmail.com> - 2024-02-19 12:09 +0000
      Re: CLHS on *DEBUG-IO* and others Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-19 17:40 +0000
        Synonym Streams Alan Bawden <alan@csail.mit.edu> - 2024-02-19 17:06 -0500
          Re: Synonym Streams Spiros Bousbouras <spibou@gmail.com> - 2024-02-20 17:54 +0000
          Re: Synonym Streams steve <sgonedes1977@gmail.com> - 2024-04-14 11:36 -0400
            Re: Synonym Streams Alan Bawden <alan@csail.mit.edu> - 2024-04-14 18:49 -0400
            Re: Synonym Streams Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-15 00:49 +0000
              Re: Synonym Streams steve <sgonedes1977@gmail.com> - 2024-04-19 13:44 -0400
        Re: CLHS on *DEBUG-IO* and others Spiros Bousbouras <spibou@gmail.com> - 2024-02-20 17:47 +0000
          Re: CLHS on *DEBUG-IO* and others Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-20 18:18 +0000

csiph-web