[Pharo-users] Streams for FileReference in Pharo 7

Jan Blizničenko jan.bliznicenko at fit.cvut.cz
Fri Feb 15 03:52:20 EST 2019


Hello everyone

I am trying to use Pharo 7 for my project and I noticed that most of my
streams related code does not work anymore. Reason is that API for streams
received from writeStream of FileReference changed and I think it changed
for the worse in my case, because << does not properly handle any other
objects than strings anymore.

In both Pharo 6 and 7 I can write
String streamContents: [ :s | s << 'hello' << 42 << $! ].
and get 'hello42!'.
I can write in Pharo 6 but cannot in Pharo 7
'hello.txt' asFileReference writeStreamDo: [ :s | s << 'hello' << 42 << $! ]
In Pharo 6, I get same result in both examples (written to the file in
second case of course), but in Pharo 7, the second example results in
exception because << does not work with anything other than strings, so it
seems I have to manually convert everything to strings.

This change to streams seems to me like a setback for 2 reasons:
1) API amongst streams is no longer consistent in this case
2) streams for files lost useful functionality and to make my project
compatible with Pharo 7, I have to make lots of effort to make my code
uglier and longer

I would like to ask for the reason of this change and whether is there
anything that can be done with it. Or do I just misuse or misunderstand
anything? Thank you.

Best regards,
Jan



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



More information about the Pharo-users mailing list