<br><br><div class="gmail_quote">2009/11/24 Colin Putney <span dir="ltr"><<a href="mailto:cputney@wiresong.ca">cputney@wiresong.ca</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
On 23-Nov-09, at 10:41 PM, Denis Kudriashov wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2009/11/21 Colin Putney <<a href="mailto:cputney@wiresong.ca" target="_blank">cputney@wiresong.ca</a>><br>
I really need to rewrite the tutorial to de-emphasize paths. You should use FSReference for everything. Once I get Eliot's suggestion implemented, the above will be:<br>
<br>
ref := FSReference D / 'Squeak' / '3.10'.<br>
<br>
Hi<br>
<br>
I don't like global objects referencess in code. I cant mock global object in tests.<br>
I like VW dsl for that. For FileSystem it's can be:<br>
<br>
'd://squeak/3.10' asFileReference.<br>
</blockquote>
<br></div>
I'm not sure I follow. The only global here is the class FSReference. #D is an instance creation method. I don't see how the message you suggest is any more flexible. You can't mock out the implementation of asFileReference any more easily than that of #D, right?</blockquote>
<div><br>No. But maybe it's not really problem. For method<br><br>writeMessageTo: filename<br> FSReference / filename writeStreamDo: [:s | ... ]<br> <br>I can't mock writing data to real file. <br>But I can rewrite this method with "filename" as FSReference:<br>
<br>writeMessageTo: filename<br>
filename writeStreamDo: [:s | ... ]<br><br>And now I can mock this behavior by pass mockobject as filename instead of real FSReference.<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
</blockquote>
And I think syntax based on strings more simple and elegant:<br>
<br>
'smalltalk' \ 'squeak' \ '3.10' writeStreamDo: [: f | ]<br><br>'smalltalk\squeak' \ '3.10' writeStreamDo: [: f | ]<br>
<br>
'smalltalk\squeak' asFileReference<font color="#888888"><br><br>
</font></div><div>And last expression will hide work with disks on windows (when we wrote <br> 'c:/smalltalk' asFileReference <br>or <br> 'c:' \ 'smalltalk' <br>)<br><br>I use message #\ because #/ already used in String protocol<br>
<br></div></div><br>