Closed masinter closed 1 year ago
I think there was an issue about this, that it is supposed to get the format from an eventfn, maybe defaulting to :UTF-8.
On Oct 8, 2022, at 8:38 PM, Larry Masinter @.***> wrote:
There's a problem with creating streams with some odd interactions interfering. Both ShellCommand("pwd") and CHAT(SHELL) die with ERROR: NIL is not an external format, a call to FIND-FORMAT(NIL NIL) called by \EXTERNALFORMAT.
This is due to the STREAM record having an ACCESSFUNS 'CREATE' method at the end
(CREATE (PROGN (\EXTERNALFORMAT DATUM (OR (FETCH (FDEV DEFAULTEXTERNALFORMAT) OF (FFETCH (STREAM DEVICE) OF DATUM)) :DEFAULT)) DATUM)) which calls in a lot of complicated logic for just creating an empty STREAM. Somehow DATUM is NIL https://user-images.githubusercontent.com/1116587/194735217-8e291ca5-b24e-4fec-a434-39342ea708db.png but trying to debug this runs into another problem -- trying to print out (NCREATE 'STREAM) results in an object that can't be printed, because it is a STREAM without a FDEV file device. you can't inspect it or anything.
— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/980, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJJ3MLAGOTZN3PKD353WCI44NANCNFSM6AAAAAARAQMID4. You are receiving this because you are subscribed to this thread.
There are two issues: one about \EXTERNALFORMAT and various cases (streams without FDEV for example) and another about CYGWIN and creating process streams around it. I'll change the title of this issue and make another one for CYGWIN.
We should walk through this. \EXTERNALFORMAT makes a lot of assumptions that aren't true at interim states (like during a (create STREAM) but also others. It's easy to get lost in the various cases, and switching between the "external format" as a DATATYPE and the name of the external format :UTF-8 :XCCS . INCHARFN OUTCHARFN of the stream being replaced by the corresponding fields in the EXTERNALFORMAT kind of misses the point of having them per-stream? Anyway maybe we can go over this screen share?
I'm not sure which values should appear in the DEFAULT-EXTERNALFORMAT and in FDEV in the READ environment etc. And is :DEFAULT always allowed?
the simple example is that if you type (create STREAM) it will make a STREAM object but then will error ARG NOT FDEV when trying to print the result.
I don’t think this is from printing, I think it is a problem in the creation itself. On the (perhaps incorrect) theory that a stream datum without a file device is ill-formed, I made the CREATE form try to install a format that it gets from its device.
This could be changed so that it leaves the format field (and the various format functions) empty if the device isn’t explicity assigned in the create expression. Or in that case it always installs the current global default format, the value of DEFAULT-EXTERNALFORMAT, so that the default character input/output functions are always present.
(Currently the global default is :XCCS, but I’m thinking of defining a “guessing” format that starts out as 7-bit ascii but makes an informed guess (UTF-8, XCCS, ISO8859/1)) based on the most likely disambiguating inferences it can make after the first high-order one-bit is encountered. It is awkward now to pass format information around through various function calls—we don’t have a syntax for packing that into filename-strings and we haven’t extended commonlisp paths. This guesser wouldn’t be 100% accurate (it might mistake an ISO8859/1 y-umlaut for an NS charset shift, or mistake some other funky sequences as legal UTF-8), but the convenience would probably be worth it.)
On Apr 18, 2023, at 5:30 PM, Larry Masinter @.***> wrote:
the simple example is that if you type (create STREAM) it will make a STREAM object but then will error ARG NOT FDEV when trying to print the result.
— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/980#issuecomment-1513952218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJPI34DFKP6GEU5IC7LXB4W37ANCNFSM6AAAAAARAQMID4. You are receiving this because you commented.
There's a problem with creating streams with some odd interactions interfering. Both ShellCommand("pwd") and CHAT(SHELL) die with ERROR: NIL is not an external format, a call to FIND-FORMAT(NIL NIL) called by \EXTERNALFORMAT.
This is due to the STREAM record having an ACCESSFUNS 'CREATE' method at the end
which calls in a lot of complicated logic for just creating an empty STREAM. Somehow DATUM is NIL
but trying to debug this runs into another problem -- trying to print out (NCREATE 'STREAM) results in an object that can't be printed, because it is a STREAM without a FDEV file device. you can't inspect it or anything.