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


Groups > comp.lang.lisp > #59524

Re: Synonym Streams

Path csiph.com!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!69.80.99.27.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Sun, 14 Apr 2024 15:36:12 +0000
From steve <sgonedes1977@gmail.com>
Newsgroups comp.lang.lisp
Subject Re: Synonym Streams
References <6pd1+E7bUWxwHGM59@bongo-ra.co> <uqtv0o$1fckl$2@dont-email.me> <23FZrFyCKlaZfJP1R@bongo-ra.co> <20240219092306.348@kylheku.com> <867cj0qfbq.fsf_-_@williamsburg.bawden.org>
Date Sun, 14 Apr 2024 11:36:11 -0400
Message-ID <8734roez2s.fsf@gmail.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13)
Cancel-Lock sha1:qbsZmmH4/M+cVEPXqJbnOM7FpaE=
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Lines 54
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-uIGVqe6N2HiQaplOV95qlEaJCfkl3iucTl75mA/wmV6WL+ScRTaxdSZ5DXt6oBst4npVpOCI+AxGuKj!y/R+O1OCSeTbzc8dPZpp0cCGXKhuhT5pCy5o3O6jz+DgGQ==
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
Xref csiph.com comp.lang.lisp:59524

Show key headers only | View raw


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'm not aware of any modern system where I/O has this feature.

POSIX man dup

> 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.

;;
;;; Macros

(defmacro with-open-file-stream (direction type options &body body)
  `(with-open-file
       (,@options :direction ,direction :element-type ,type)
     ,@body))

(defmacro with-binary-input-stream (options &body forms)
  `(with-open-file-stream :input '(unsigned-byte 8) ,options ,@forms))

(defmacro with-ascii-input-stream (options &body forms)
  `(with-open-file-stream :input 'character ,options ,@forms))

(defmacro with-ascii-output-stream (options &body forms)
  `(with-open-file-stream :output 'character ,options ,@forms))

(defmacro with-binary-output-stream (options &body forms)
  `(with-open-file-stream :output '(unsigned-byte 8) ,options ,@forms))


> streams to solve some real problem.

i do not have real problems.

> - Alan

steve

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