Hi, I'm working in latest Pharo (30577) with STON (bleeding edge) and I get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system. | fileSystem | fileSystem := FileSystem memory. (fileSystem / 'file.txt') ensureCreateFile. STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'. STON reader on: (fileSystem / 'file.txt') readStream; next. Thanks in advance. MartÃn
Note: It works fine if I use `FileSystem workingDirectory`. Also it works with: | aWriteStream | aWriteStream := '' writeStream. STON writer on: aWriteStream; nextPut: 'hi'. STON reader on: aWriteStream contents readStream; next. Thanks again, MartÃn On Fri, Nov 8, 2013 at 1:55 PM, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'. STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
Hi Martin, I would guess that the stream created by the memory filesystem are binary, not character, as STON expects. Sven On 08 Nov 2013, at 13:55, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'.
STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
On 08.11.2013, at 13:59, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Martin,
I would guess that the stream created by the memory filesystem are binary, not character, as STON expects.
Good point, although currently ascii mode is still default I think. Try sending #ascii to the stream. That might help.
Sven
On 08 Nov 2013, at 13:55, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'.
STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
Thanks, but it's the same: the streams are instances of WriteStream and ReadStream... the implementation of #ascii in ReadStream is empty, and WriteStream doesn't respond to #ascii. On Fri, Nov 8, 2013 at 2:19 PM, Max Leske <maxleske@gmail.com> wrote:
On 08.11.2013, at 13:59, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Martin,
I would guess that the stream created by the memory filesystem are binary, not character, as STON expects.
Good point, although currently ascii mode is still default I think. Try sending #ascii to the stream. That might help.
Sven
On 08 Nov 2013, at 13:55, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I get
MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'.
STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
Sven, you are right. I checked that MemoryHandle>>readStream creates a ReadStream on it's internal byte array. Then, the answer to #next it's not a Character but a SmallInteger. Ok, anyway I can avoid using `FileSystem memory`. I was just trying to make my test suite not use the physical disk. Just an optimization... Thanks, MartÃn On Fri, Nov 8, 2013 at 3:04 PM, Martin Dias <tinchodias@gmail.com> wrote:
Thanks, but it's the same: the streams are instances of WriteStream and ReadStream... the implementation of #ascii in ReadStream is empty, and WriteStream doesn't respond to #ascii.
On Fri, Nov 8, 2013 at 2:19 PM, Max Leske <maxleske@gmail.com> wrote:
On 08.11.2013, at 13:59, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Martin,
I would guess that the stream created by the memory filesystem are binary, not character, as STON expects.
Good point, although currently ascii mode is still default I think. Try sending #ascii to the stream. That might help.
Sven
On 08 Nov 2013, at 13:55, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I
get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'.
STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
welcome to the stream-hell of pharo :( This is all a big mess, since all streams are doing everything: binary, text, utf8, custom character conversion :P But yes, this is a bug of the memory filesystem... On 2013-11-08, at 15:22, Martin Dias <tinchodias@gmail.com> wrote:
Sven, you are right. I checked that MemoryHandle>>readStream creates a ReadStream on it's internal byte array. Then, the answer to #next it's not a Character but a SmallInteger.
Ok, anyway I can avoid using `FileSystem memory`. I was just trying to make my test suite not use the physical disk. Just an optimization...
Thanks, MartÃn
On Fri, Nov 8, 2013 at 3:04 PM, Martin Dias <tinchodias@gmail.com> wrote: Thanks, but it's the same: the streams are instances of WriteStream and ReadStream... the implementation of #ascii in ReadStream is empty, and WriteStream doesn't respond to #ascii.
On Fri, Nov 8, 2013 at 2:19 PM, Max Leske <maxleske@gmail.com> wrote:
On 08.11.2013, at 13:59, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Martin,
I would guess that the stream created by the memory filesystem are binary, not character, as STON expects.
Good point, although currently ascii mode is still default I think. Try sending #ascii to the stream. That might help.
Sven
On 08 Nov 2013, at 13:55, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'.
STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
On 08 Nov 2013, at 16:10, Camillo Bruni <camillobruni@gmail.com> wrote:
welcome to the stream-hell of pharo :( This is all a big mess, since all streams are doing everything: binary, text, utf8, custom character conversion :P
Yes, #binary and #ascii expect the streams to modify themselves automagically ;-) Not that it fundamentally solves the current problem, but a clean way to turn a binary read/write stream into a character on is ZnCharacterReadStream on: binaryStream and ZnCharacterWriteStream on: binaryStream they do utf-8 by default, but could work with any encoding (on:encoding:). Sven
But yes, this is a bug of the memory filesystem...
On 2013-11-08, at 15:22, Martin Dias <tinchodias@gmail.com> wrote:
Sven, you are right. I checked that MemoryHandle>>readStream creates a ReadStream on it's internal byte array. Then, the answer to #next it's not a Character but a SmallInteger.
Ok, anyway I can avoid using `FileSystem memory`. I was just trying to make my test suite not use the physical disk. Just an optimization...
Thanks, MartÃn
On Fri, Nov 8, 2013 at 3:04 PM, Martin Dias <tinchodias@gmail.com> wrote: Thanks, but it's the same: the streams are instances of WriteStream and ReadStream... the implementation of #ascii in ReadStream is empty, and WriteStream doesn't respond to #ascii.
On Fri, Nov 8, 2013 at 2:19 PM, Max Leske <maxleske@gmail.com> wrote:
On 08.11.2013, at 13:59, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Martin,
I would guess that the stream created by the memory filesystem are binary, not character, as STON expects.
Good point, although currently ascii mode is still default I think. Try sending #ascii to the stream. That might help.
Sven
On 08 Nov 2013, at 13:55, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'.
STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
On Nov 8, 2013, at 4:10 PM, Camillo Bruni <camillobruni@gmail.com> wrote:
welcome to the stream-hell of pharo :( This is all a big mess, since all streams are doing everything: binary, text, utf8, custom character conversion :P
We should not start replacing them now but they are in our radar since long time.
But yes, this is a bug of the memory filesystem...
On 2013-11-08, at 15:22, Martin Dias <tinchodias@gmail.com> wrote:
Sven, you are right. I checked that MemoryHandle>>readStream creates a ReadStream on it's internal byte array. Then, the answer to #next it's not a Character but a SmallInteger.
Ok, anyway I can avoid using `FileSystem memory`. I was just trying to make my test suite not use the physical disk. Just an optimization...
Thanks, MartÃn
On Fri, Nov 8, 2013 at 3:04 PM, Martin Dias <tinchodias@gmail.com> wrote: Thanks, but it's the same: the streams are instances of WriteStream and ReadStream... the implementation of #ascii in ReadStream is empty, and WriteStream doesn't respond to #ascii.
On Fri, Nov 8, 2013 at 2:19 PM, Max Leske <maxleske@gmail.com> wrote:
On 08.11.2013, at 13:59, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Martin,
I would guess that the stream created by the memory filesystem are binary, not character, as STON expects.
Good point, although currently ascii mode is still default I think. Try sending #ascii to the stream. That might help.
Sven
On 08 Nov 2013, at 13:55, Martin Dias <tinchodias@gmail.com> wrote:
Hi,
I'm working in latest Pharo (30577) with STON (bleeding edge) and I get MNU:SmallInteger>>isSeparator when I evaluate the code below. Is my code wrong? The idea is to make my test suite work in the memory file system.
| fileSystem | fileSystem := FileSystem memory.
(fileSystem / 'file.txt') ensureCreateFile.
STON writer on: (fileSystem / 'file.txt') writeStream; nextPut: 'hi'.
STON reader on: (fileSystem / 'file.txt') readStream; next.
Thanks in advance.
MartÃn
participants (5)
-
Camillo Bruni -
Martin Dias -
Max Leske -
Stéphane Ducasse -
Sven Van Caekenberghe