<br><br><div class="gmail_quote">On Wed, Jul 6, 2011 at 8:36 PM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
On 7 July 2011 05:28, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Wed, Jul 06, 2011 at 06:38:10PM -0700, Eliot Miranda wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Jul 6, 2011 at 6:31 PM, Igor Stasenko &lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; With a new version of plugin submitted by Eliot it no longer crashing :)<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; Slang is occasionally super-tricky.  If you write<br>
&gt;&gt;<br>
&gt;&gt;     self atexit: #sendSignalToPids<br>
&gt;&gt;<br>
&gt;&gt; it generates<br>
&gt;&gt;<br>
&gt;&gt;     atexit(&quot;sendSignalToPids&quot;)<br>
&gt;&gt;<br>
&gt;&gt; which will crash.  You must write<br>
&gt;&gt;<br>
&gt;&gt;     self atexit: #sendSignalToPids asSymbol<br>
&gt;&gt;<br>
&gt;&gt; to get it to generate<br>
&gt;&gt;<br>
&gt;&gt;     atexit(sendSignalToPids)<br>
&gt;&gt;<br>
&gt;&gt; (where sendSignalToPids is some function to be called at exit).<br>
&gt;&gt;<br>
&gt;&gt; If course we should change this but there&#39;s backwards-compatibility for<br>
&gt;&gt; plugin to consider.  Does anyone depend on the old behavior?  I&#39;ve been<br>
&gt;&gt; bitten more than a few times by this.  Sigh...<br>
&gt;<br>
&gt; Symbols and strings are used more or less interchangably in C translation<br>
&gt; (aka &quot;slang&quot;) and in pragmas. So I think that there is a general expectation<br>
&gt; that either a symbol or a string would translate to C as a string. In<br>
&gt; the case of #sendSignalToPids, this is actually a function pointer that<br>
&gt; is being used in a rather specialized context. So even though the<br>
&gt; translation of &#39;self atexit: #sendSignalToPids&#39; produces a surprising<br>
&gt; result in this case, I would still say that is reasonable to expect<br>
&gt; Smalltalk symbols and strings to both translate into C strings, and<br>
&gt; it would not be reasonable to expect a simple C translator to do<br>
&gt; enough type checking to figure out that in this particular case the<br>
&gt; &#39;#sendSignalToPids&#39; should be treated as a function pointer rather<br>
&gt; than as a string.<br>
&gt;<br>
<br>
</div></div>I concur not. As to me a least surprising behaviour for code generator<br>
would be to covert symbols to<br>
identifiers with same name, instead of literal strings.<br></blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
&gt; The original method in UnixOSProcessPlugin is written as follows in<br>
&gt; order to avoid this issue:<br>
&gt;<br>
&gt;        self cCode: &#39;atexit(sendSignalToPids)&#39;.<br>
&gt;<br>
<br>
</div>the problem with above code that it doesn&#39;t tells code generator to<br>
keep sendSignalToPids method around,<br>
instead of pruning it since nobody using it.<br>
That&#39;s why in hydra i added this special asCIdentifier to not only<br>
convert symbol to identifier (instead of quoted C string)<br>
but also make sure that if given symbol matching the method name ,<br>
then make sure that this method won&#39;t be pruned.<br>
<br>
And of course , when browsing the code i can see senders of it, while<br>
if i forced to use cCode: &#39;yaddayadda&#39;,<br>
it will hide the usage from our eyes.<br>
<br>
So, one way or another, but the less cCode: we have, the better.<br></blockquote><div><br></div><div>+1000</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
&gt; I also note that the purpose of SlangBrowser is to make it easy to<br>
&gt; review code like this while it is being written, so I guess that I<br>
&gt; should get off my butt and get this working in the oscog branch one<br>
&gt; of these days :-/<br>
&gt;<br>
&gt; Dave<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div>--<br>
<div><div></div><div class="h5">Best regards,<br>
Igor Stasenko AKA sig.<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>best,<div>Eliot</div><br>