On 2024-02-19, Spiros Bousbouras <
[email protected]> wrote:
On Sun, 18 Feb 2024 22:06:16 -0000 (UTC)
Lawrence D'Oliveiro <[email protected]d> 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: @
[email protected]
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)