<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Sep 18, 2008 at 9:44 AM, Rob Withers <span dir="ltr">&lt;<a href="mailto:reefedjib@yahoo.com">reefedjib@yahoo.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 bgcolor="#ffffff">
<div><font face="Arial" size="2">:-)</font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div><font face="Arial" size="2">I just compiled with:</font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div><font face="Arial" size="2">&nbsp;(twoWayFlag not and: [copyHashFlag 
not])<br>&nbsp;&nbsp;ifTrue: [(self containOnlyOops: array1) ifFalse: 
[^false]]<br>&nbsp;&nbsp;ifFalse: [(self containOnlyOops: array1 and: array2) 
ifFalse: [^false]].<br></font></div>
<div><font face="Arial" size="2">but I like your positive logic better.&nbsp; 
Thanks!</font></div></div></blockquote><div><br></div><div>Forgive me, you&#39;ve got me started :) &nbsp;I hate it when people don&#39;t cut down on their conditionals. &nbsp;I saw this the other day (won&#39;t tell you where) and it drives me *batty*.</div>
<div><br></div><div>&nbsp;&nbsp; &nbsp;if((options &amp; LINK_OPTION_PRIVATE) == LINK_OPTION_PRIVATE)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;object_image-&gt;image.private = TRUE;</div><div>&nbsp;&nbsp; &nbsp;else</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;object_image-&gt;image.private = FALSE;</div>
<div><br></div><div>the following takes 25% of the vertical real estate and says it better.</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;object_image-&gt;image.private =&nbsp;options &amp; LINK_OPTION_PRIVATE) == LINK_OPTION_PRIVATE;</div>
<div><br></div><div>Even worse is the following idiom:</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(print_addresses == TRUE)<br></div><div><br></div><div>I mean if you&#39;re that doubtful surely you want to use belt-and-braces and write</div>
<div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(((print_addresses == TRUE) == TRUE) == TRUE)<br></div><div><br></div><div>to be free of anxiety.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff"><div><font face="Arial" size="2"></font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div><font color="#888888">
<div><font face="Arial" size="2">Rob</font></div>
</font><blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:#000000 2px solid;margin-right:0px"><div class="Ih2E3d">
  <div style="font:10pt arial">----- Original Message ----- </div>
  <div style="background:#e4e4e4;font:10pt arial"><b>From:</b> 
  <a title="eliot.miranda@gmail.com" href="mailto:eliot.miranda@gmail.com" target="_blank">Eliot 
  Miranda</a> </div>
  <div style="font:10pt arial"><b>To:</b> <a title="squeak-dev@lists.squeakfoundation.org" href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">The general-purpose Squeak 
  developers list</a> </div>
  </div><div><div></div><div class="Wj3C7c"><div style="font:10pt arial"><b>Sent:</b> Thursday, September 18, 2008 12:41 
  PM</div>
  <div style="font:10pt arial"><b>Subject:</b> Re: [squeak-dev] Re: 
  becomeForward: alternative</div>
  <div><br></div>
  <div dir="ltr">Things work fine provided the become is one-way and hashes are 
  not copied. &nbsp;Simply change
  <div><br></div>
  <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;(self containOnlyOops: array1 and: 
  array2) ifFalse: [^false]</div>
  <div><br></div>
  <div>in ObjectMemory&gt;&gt;become:with:twoWay:copyHash: to<br>
  <div><br></div>
  <div><span style="white-space:pre"></span>(twoWayFlag 
  or: [copyHashFlag])</div>
  <div><span style="white-space:pre"></span>ifTrue: [(self 
  containOnlyOops: array1 and: array2) ifFalse: [^false]]</div>
  <div><span style="white-space:pre"></span>ifFalse: 
  [(self containOnlyOops: array1) ifFalse: [^false]].</div>
  <div><br></div>
  <div>along with the obvious implementation of&nbsp;containOnlyOops:.</div>
  <div>If so,</div>
  <div>
  <div><span style="white-space:pre"></span>| foo bar 
  |</div>
  <div><span style="white-space:pre"></span>foo := 
  1@2.</div>
  <div><span style="white-space:pre"></span>bar := { foo. 
  foo }.</div>
  <div><span style="white-space:pre"></span>foo 
  becomeForward: 0 copyHash: false.</div>
  <div><span style="white-space:pre"></span>{ foo. bar 
  }</div>
  <div>produces</div>
  <div><span style="white-space:pre"></span>#(0 #(0 
  0))</div></div>
  <div><br></div>
  <div class="gmail_quote">On Thu, Sep 18, 2008 at 9:09 AM, Rob Withers <span dir="ltr">&lt;<a href="mailto:reefedjib@yahoo.com" target="_blank">reefedjib@yahoo.com</a>&gt;</span> 
wrote:<br>
  <blockquote class="gmail_quote" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:#ccc 1px solid"><br>----- 
    Original Message ----- From: &quot;Paolo Bonzini&quot; &lt;<a href="mailto:bonzini@gnu.org" target="_blank">bonzini@gnu.org</a>&gt;<br>To: 
    &quot;The general-purpose Squeak developers list&quot; &lt;<a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>&gt;<br>Sent: 
    Tuesday, September 16, 2008 3:59 PM<br>Subject: [squeak-dev] Re: 
    becomeForward: alternative
    <div>
    <div></div>
    <div><br><br><br>
    <blockquote class="gmail_quote" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:#ccc 1px solid">Rob 
      Withers wrote:<br>
      <blockquote class="gmail_quote" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:#ccc 1px solid">I 
        am trying to becomeForward with an object and a small integer. 
        &nbsp;This<br>of course doesn&#39;t work. &nbsp;Is there an alternative that 
        would allow me to<br>do this?<br></blockquote><br>There&#39;s actually no 
      reason why the *destination* of a becomeForward:<br>cannot be a 
      SmallInteger. &nbsp;It&#39;s a VM bug in my 
    opinion.<br><br></blockquote><br></div></div>Thanks, Paolo.<br><br>I tried 
    looking into this a bit and here is what I have found. &nbsp;First off, this 
    will only work with<br>&nbsp; #elementsForwardIdentityTo: 
    anArrayWithSmallIntegers copyHash: false.<br>It would not work to copy the 
    source hash to a SmallInteger.<br><br>Next is understanding forwarding 
    blocks and the process of remapping objects using them. &nbsp;There are 
    three steps:<br>&nbsp; 1) #prepareForwardingTableForBecoming:with:twoWay: 
    &nbsp;&quot;create and init forwarding blocks, and install into original 
    headers&quot;<br>&nbsp; 2) #mapPointersInObjectsFrom:to: &nbsp;&quot;point pointers to 
    forwarded oop&quot;<br>&nbsp; 3) #restoreHeadersAfterForwardBecome: &quot;restore 
    original headers&quot;<br>The question seems to come down to the following. 
    &nbsp;Can forwarding blocks point to SmallIntegers?<br><br>Rob<br><br>
    <blockquote class="gmail_quote" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:#ccc 1px solid">Paolo<br><br></blockquote><br><br></blockquote></div><br></div></div>
  </div></div><p>
  </p><hr>

  <p></p><br><p></p></blockquote></div>
<br><br>
<br></blockquote></div><br></div>