Giter VIP home page Giter VIP logo

squeak-filesystem's People

Contributors

fniephaus avatar j4yk avatar linqlover avatar tom95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

squeak-filesystem's Issues

`#writeStream` does not clear old file contents, should it?

ref := FileSystem disk workingDirectory / 'fstest.txt'.
ref writeStreamDo: [:stream |
	stream nextPutAll: 'abcde'].
ref contents. "'abcde'"
ref writeStreamDo: [:stream |
	stream nextPutAll: 'XYZ'].
ref contents "'XYZde'"

I would have expected just 'XYZ', analogously to FileStream class>>#forceNewFileNamed:.

But, is this a bug or intended behavior?

This issue can be avoided by sending assureDeleted to the reference prior to opening it for the second write. But this sounds less convenient than Squeak's built-in protocols ... And (to me) this was quite surprising and cost me a lot of time to debug. ๐Ÿ˜…

Limited compatibility with FileStream

We noticed several compatibility issues that severely limit the applicability of FS in Squeak:

  • Different behavior of next: In Squeak's Files package, it answers nil when 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, StandardFileStream reads files byte per byte as opposed to MultiByteFileStream which uses a converter. All FSStreams 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 using StandardFileStream.

  • basicBack is missing on FSReadStream which is sent from UTF8TextConverter in 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 ... :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.