-
Notifications
You must be signed in to change notification settings - Fork 3
Description
We noticed several compatibility issues that severely limit the applicability of FS in Squeak:
-
Different behavior of
next: In Squeak's Files package, it answersnilwhen at the end of the stream. FS raises an error.e.g., this makes it incompatible with Json:
FileSystem memory in: [:fs | fs / 'test.txt' writeStreamDo: [:s | 'squeak' jsonWriteOn: s]; readStreamDo: [:s | Json readFrom: s]] "⚡ Error: subscript is out of bounds: 8"
-
No single-byte file stream option: In the Files package,
StandardFileStreamreads files byte per byte as opposed toMultiByteFileStreamwhich uses a converter. AllFSStreams require the use of a converter. Since there seems not to be something as a null converter (?), this makes it impossible to read files that were written usingStandardFileStream. -
basicBackis missing onFSReadStreamwhich is sent fromUTF8TextConverterin response to#skip:. E.g.:FileSystem memory in: [:fs | fs / 'test.txt' writeStreamDo: [:s | 'squeak' jsonWriteOn: s. s nextPut: Character null]; readStreamDo: [:s | Json readFrom: s]] "⚡ MNU: #basicBack"
Does this implementation make sense?
FSReadStream>>basicBack | result | result := handle at: position - 1. position := position - 1. isBinary ifFalse: [result := result asCharacter]. ^ result
-
No support for data get/put protocol which limits usage for Sounds and others. See hpi-swa/Squot@4b35071 for more details. /cc @MariusDoe
In general, the question remains how much compatibility is desired ... but I would like it ... :-)