• Re: CLHS on *DEBUG-IO* and others

    From Kaz Kylheku@21:1/5 to Spiros Bousbouras on Sat Feb 17 16:34:02 2024
    On 2024-02-17, Spiros Bousbouras <spibou@gmail.com> 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 seems to be because generalized synonym stream means two things:
    it can target stream objects or symbols. It seems to be saying that
    *debug-io* may be the same stream as one held in another such variable,
    but not an alias for such a variable itself.

    In other words the requirement seems to be that if *debug-io* were, say,
    the same as *stdandard-output*, and the application assigns or binds a
    new value to *standard-output*, *debug-io* must not be affected.

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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Spiros Bousbouras on Sun Feb 18 22:06:16 2024
    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”?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Spiros Bousbouras on Mon Feb 19 17:40:29 2024
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Spiros Bousbouras on Tue Feb 20 18:18:45 2024
    On 2024-02-20, Spiros Bousbouras <spibou@gmail.com> wrote:
    And how is this different from what I wrote in my opening post , namely

    .... that is not a generalized synonym stream to any of the standard I/O
    customization variables but that might be a generalized synonym stream to
    the value of some implementation defined I/O customization variable.

    I wrote with the objective that my written understanding not be
    different from what the above means. If you also find that so, it
    increases my confidence.

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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)