<div dir="ltr">Hi Bert,<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 1, 2014 at 7:13 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On 01.09.2014, at 15:56, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>

<br>
&gt;&gt; Another thought is that given the abundance of memory these days, we might cache both sources and changes in main memory (which would also speed up full-text searches).<br>
&gt;<br>
&gt; Pharo is planning to eliminate them altogether which is more coherent than caching them.<br>
<br>
</div>That&#39;s another discussion, but it might be a step towards that.<br>
<div class=""><br>
&gt;  But IMO the solution is easy, maintain a *single* read-only copy of the sources and changes files in SourceFilesArray (or whatever the class is called; I&#39;m on my phone) and read source through them instead of reopen ing the damn things all the time.<br>

<br>
</div>Except that Squeak files do not maintain an independent file position pointer, so reading from different positions in the same file is not thread-safe. That&#39;s why the file is opened again.<br></blockquote><div>
<br></div><div>Can you explain more.  I don&#39;t understand.  As I see it every file instance has its own FILE structure so I don&#39;t understand how this can be so.  Files are derived from FilePlugin&#39;s primitiveFileOpen function.  That is implemented in terms of fileOpenNamesizewritesecure, which allocates a ByteArray to hold state (so no two Smalltalk files share state) and then uses sqFileOpen to open the underlying file and fill in the state.  The C library implementation of sqFileOpen in platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c uses fopen et al, again creating unique state.  So I don&#39;t see how having a writable Smalltalk file and a separate read-only Smalltalk file on the sources and changes can result in other than two separate independent file pointers.</div>
<div><br></div><div>There *is* an issue with the structure of file access in the debugger.  If one were to step through execution of accessing source from e.g. the read-only sources file then the very act of fetching sources for the methods being displayed would confuse the state in the file one was observing through the debugger.  But that&#39;s hardly a new situation (one can get into a similar situation with the current setup), and the debugger could ease the situation by wrapping source access with something that reset the file&#39;s buffer etc.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><br>
&gt; Then the file&#39;s own buffers will provide done caching.  Annoying that I write this code in 2008 for newspeak but we still rely on the mad &quot;run the GC to finalize files when open fails&quot; approach.<br>
<br>
</div>Well, you writing this for newspeak does not immediately benefit Squeak. But if you point us to the code maybe someone can port it to Squeak?<br></blockquote><div><br></div><div>I already did a year or two ago and it got shot down on the debugger grounds I reiterated above.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><font color="#888888"><br>
- Bert -<br>
<br>
<br>
<br>
</font></span><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>