<br><br><div class="gmail_quote">On Wed, Jul 6, 2011 at 8:36 PM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>></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 <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br>
><br>
> On Wed, Jul 06, 2011 at 06:38:10PM -0700, Eliot Miranda wrote:<br>
>><br>
>> On Wed, Jul 6, 2011 at 6:31 PM, Igor Stasenko <<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>> wrote:<br>
>><br>
>> ><br>
>> > With a new version of plugin submitted by Eliot it no longer crashing :)<br>
>> ><br>
>><br>
>> Slang is occasionally super-tricky. If you write<br>
>><br>
>> self atexit: #sendSignalToPids<br>
>><br>
>> it generates<br>
>><br>
>> atexit("sendSignalToPids")<br>
>><br>
>> which will crash. You must write<br>
>><br>
>> self atexit: #sendSignalToPids asSymbol<br>
>><br>
>> to get it to generate<br>
>><br>
>> atexit(sendSignalToPids)<br>
>><br>
>> (where sendSignalToPids is some function to be called at exit).<br>
>><br>
>> If course we should change this but there's backwards-compatibility for<br>
>> plugin to consider. Does anyone depend on the old behavior? I've been<br>
>> bitten more than a few times by this. Sigh...<br>
><br>
> Symbols and strings are used more or less interchangably in C translation<br>
> (aka "slang") and in pragmas. So I think that there is a general expectation<br>
> that either a symbol or a string would translate to C as a string. In<br>
> the case of #sendSignalToPids, this is actually a function pointer that<br>
> is being used in a rather specialized context. So even though the<br>
> translation of 'self atexit: #sendSignalToPids' produces a surprising<br>
> result in this case, I would still say that is reasonable to expect<br>
> Smalltalk symbols and strings to both translate into C strings, and<br>
> it would not be reasonable to expect a simple C translator to do<br>
> enough type checking to figure out that in this particular case the<br>
> '#sendSignalToPids' should be treated as a function pointer rather<br>
> than as a string.<br>
><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>
> The original method in UnixOSProcessPlugin is written as follows in<br>
> order to avoid this issue:<br>
><br>
> self cCode: 'atexit(sendSignalToPids)'.<br>
><br>
<br>
</div>the problem with above code that it doesn't tells code generator to<br>
keep sendSignalToPids method around,<br>
instead of pruning it since nobody using it.<br>
That'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'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: 'yaddayadda',<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>
> I also note that the purpose of SlangBrowser is to make it easy to<br>
> review code like this while it is being written, so I guess that I<br>
> should get off my butt and get this working in the oscog branch one<br>
> of these days :-/<br>
><br>
> Dave<br>
><br>
><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>