[Pharo-project] [Idiom] 'myfile.txt' asFileName readStream contents

Peter Hugosson-Miller oldmanlink at gmail.com
Sat Oct 30 07:31:23 EDT 2010


Sure, but when you send #readStream to a String, then you'll always get a
ReadStream on that String.

Perhaps there is a similarly-named method like #asReadFileStream that he
meant to write instead (and that is just a guess, since I have no way of
checking at the moment)

-- 
Cheers,
Peter

On Sat, Oct 30, 2010 at 1:14 PM, Hannes Hirzel <hannes.hirzel at gmail.com>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.
>
> --Hannes
>
> On 10/30/10, Peter Hugosson-Miller <oldmanlink at gmail.com> wrote:
> > The result you got is what I would have expected too.
> >
> > --
> > Cheers,
> > Peter
> >
> > On Sat, Oct 30, 2010 at 12:50 PM, Hannes Hirzel
> > <hannes.hirzel at gmail.com>wrote:
> >
> >> Hello
> >>
> >> Randal Schwartz writes in his blog
> >>
> >>
> http://methodsandmessages.posterous.com/writestreams-of-consciousness-going-to-xtream
> >> 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.
> >>
> >> Comments?
> >>
> >> Regards
> >>
> >> Hannes
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20101030/6706b239/attachment-0001.html>


More information about the Pharo-dev mailing list