medley
medley copied to clipboard
Broadcast stream streams and echo-stream external format
Current MAKE-BROADCAST-STREAM just checks that each of the target streams is a stream, causes an error only on a non-stream. It doesn’t check the access mode at broadcast-stream creation time, the error would be deferred until the first writing attempt.
Steele only says that the streams are streams. Is there some place a more detailed specification? Would it be an ill-advised departure from the standard to tighten this up?
That has nothing to do with external formats, just hygiene.
But there is another little question about echo streams and character operations. Steele says that every byte read on the input stream should be echoed on the output stream, i.e (BIN echo) = (BOUT output (BIN input)).
That’s fine if the input and output streams have the same external format (modulo the fact that XCCS could be byte-inconsistent at that point in both streams). But what if the formats are different?
I would think that echoing should also be done at the higher character level: (\INCCODE echo) = (\OUTCHAR output (\INCCODE input)) In that case the logical characters would be echoed, but the bytes wouldn’t be the same.
Obviously, they didn’t think of this. But is this the most sensible behavior in our more sophisticated world?
One other point: For most streams the function STREAMPROP can change the external format after the stream has been opened. But it seems like it should not be possible to do do that with one of these composite streams. What would it mean, for example, to change the format to UTF-8, given that the "format" of a composite stream has the various character functions that are defined to manipulate the component streams. So it seems like these streams should be marked so that an attempt to change the external format causes an error.
I believe that in the common lisp spec, the only time you can set the external format for a file is as an argument to open. There doesn't seem to be a prohibition on combining into a broadcast stream streams which have different :external-format designators.
Re: broadcast streams checking -- http://clhs.lisp.se/Body/f_mk_bro.htm#make-broadcast-stream -- says "Should signal an error of type type-error if any stream is not an output stream."
I’m glad that’s the spec, it makes sense for all of these. Not just that their arguments are streams, as the previous code, but that their arguments are strings with the proper access.
On Jul 5, 2022, at 10:52 PM, Nick Briggs @.***> wrote:
Re: broadcast streams checking -- http://clhs.lisp.se/Body/f_mk_bro.htm#make-broadcast-stream http://clhs.lisp.se/Body/f_mk_bro.htm#make-broadcast-stream -- says "Should signal an error of type type-error if any stream is not an output stream."
— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/820#issuecomment-1175809805, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJKJDRHKMHKAKNL7JX3VSUNIJANCNFSM52XGNMKQ. You are receiving this because you authored the thread.
Hmm, I see that. Commonlisp only specifies an access function for the external format (CL:STREAM-EXTERNAL-FORMAT). But the Interlisp STREAMPROP function doesn’t have that restriction. Either way, I think a composite stream doesn’t have its own format, it just passes off responsibility.
I also see, from this spec, that the commonlisp function expects the external-format object to be returned. Currently, the code is returning the name of the object (:UTF-8, :XCCS), what they may call the “external file format designator". I suppose that’s compatible, since the the external-format object is implementation dependent.
On Jul 5, 2022, at 10:49 PM, Nick Briggs @.***> wrote:
I believe that in the common lisp spec, the only time you can set the external format for a file is as an argument to open. There doesn't seem to be a prohibition on combining into a broadcast stream streams which have different :external-format designators.
— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/820#issuecomment-1175808235, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJNA77ZSSKJOHQ7OHC3VSUM5DANCNFSM52XGNMKQ. You are receiving this because you authored the thread.
I'm not sure what the issue is, though. Is there a problem with our common lisp implementation not matching the spec?
From the earlier comments it seems that STREAMPROP essentially provides an extension to the commonlisp spec, rather than an incompatibility.
On Apr 19, 2023, at 10:54 AM, Larry Masinter @.***> wrote:
I'm not sure what the issue is, though. Is there a problem with our common lisp implementation not matching the spec?
— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/820#issuecomment-1515141268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJOANYQLOP3VMW6FGZDXCARGBANCNFSM52XGNMKQ. You are receiving this because you authored the thread.