steve <
sgonedes1977@gmail.com> writes:
Alan Bawden <
alan@csail.mit.edu> writes:
> I no longer remember why we designed this whole synonym stream thing.
[ ... ]
bivalent streams are useful.
"In addition, SBCL supports various extensions of ANSI Common Lisp
streams:
*Bivalent Streams*
A type of stream that can read and write both ‘character’ and
‘(unsigned-byte 8)’ values.
I don't see any connection with synonym streams here.
> I'm not aware of any modern system where I/O has this feature.
POSIX man dup
This does not make a synonym in the sense that Common Lisp is using the
word. If it made a synonym (in the Common Lisp sense) then after:
old = open("old_file", O_RDONLY);
new = open("new_file", O_RDONLY);
fd = dup(old);
dup2(new, old);
it would be the case that reading from FD would read from "new_file".
But if you try it, you will find that FD is still reading from "old_file".
> I would be interested to know of any place that _does_ use synonym
I use the following for type 1 font dissasembler. I do not have the code
right now, but bivalent streams make it much easier to
read-char/read-byte.
The code you included isn't using synonym streams.
I think you haven't fully internalized what a weird feature synonym
streams really are. Its easy to breeze through the documentation and
think that a synonym stream is just a way to duplicate a stream. But
it's more than that: The new stream follows the _current_ value of a
dynamic variable.
- Alan
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)