[squeak-dev] Re: [Idiom] 'myfile.txt' asFileName readStream contents

Sean P. DeNigris sean at clipperadams.com
Sun Oct 31 08:47:33 UTC 2010



Hannes Hirzel-2 wrote:
> 
>> 'myfile.txt' asFileName readStream contents
> [vs.]
> (FileStream fileNamed: 'myfile.txt') contents
> 

As cool as the first one is, I prefer the second because it doesn't fatten
String.  Kent Beck's advice to reserve asXxx to simple conversions between
objects with similar protocols feels right to me (e.g. Number>>asFloat, but
not String>>asDate).

See Converter Method in
http://stephane.ducasse.free.fr/FreeBooks/BestSmalltalkPractices/Draft-Smalltalk%20Best%20Practice%20Patterns%20Kent%20Beck.pdf
-- 
View this message in context: http://forum.world.st/Idiom-myfile-txt-asFileName-readStream-contents-tp3020177p3020931.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.



More information about the Squeak-dev mailing list