[Pharo-project] [Idiom] 'myfile.txt' asFileName readStream contents
norbert at hartl.name
Sat Oct 30 07:46:03 EDT 2010
On 30.10.2010, at 13:14, Hannes Hirzel wrote:
> Surely, but not what Randal implies in terms of streams I suppose....
> The idiom implies that a file stream is created and that I get the
> content of a file -- not the content of the file name.
I read it different. You get an readStream on a filename which is a String. I would expect it to be
'myFile.txt' asFile readStream contents
'myFile.txt' asFileName file readStream contents (but than someone will bring up Demeter)
> On 10/30/10, Peter Hugosson-Miller <oldmanlink at gmail.com> wrote:
>> The result you got is what I would have expected too.
>> On Sat, Oct 30, 2010 at 12:50 PM, Hannes Hirzel
>> <hannes.hirzel at gmail.com>wrote:
>>> Randal Schwartz writes in his blog
>>> about streams citing Derek Williams http://derekwilliams.us/?p=1411
>>> He gives the following as an example of elegant syntax of Smalltalk
>>> 'myfile.txt' asFileName readStream contents
>>> This does not work in Squeak nor in Pharo.
>>> It produces a ReadStream on the contents of the _String_ 'myfile.txt'.
>>> i.e. the ByteString with 10 elements.
More information about the Pharo-dev