<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Sep 18, 2008 at 9:44 AM, Rob Withers <span dir="ltr"><<a href="mailto:reefedjib@yahoo.com">reefedjib@yahoo.com</a>></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> </div>
<div><font face="Arial" size="2">I just compiled with:</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"> (twoWayFlag not and: [copyHashFlag
not])<br> ifTrue: [(self containOnlyOops: array1) ifFalse:
[^false]]<br> ifFalse: [(self containOnlyOops: array1 and: array2)
ifFalse: [^false]].<br></font></div>
<div><font face="Arial" size="2">but I like your positive logic better.
Thanks!</font></div></div></blockquote><div><br></div><div>Forgive me, you've got me started :) I hate it when people don't cut down on their conditionals. I saw this the other day (won't tell you where) and it drives me *batty*.</div>
<div><br></div><div> if((options & LINK_OPTION_PRIVATE) == LINK_OPTION_PRIVATE)</div><div> object_image->image.private = TRUE;</div><div> else</div><div> object_image->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> object_image->image.private = options & LINK_OPTION_PRIVATE) == LINK_OPTION_PRIVATE;</div>
<div><br></div><div>Even worse is the following idiom:</div><div><br></div><div> if(print_addresses == TRUE)<br></div><div><br></div><div>I mean if you're that doubtful surely you want to use belt-and-braces and write</div>
<div><br></div><div> 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> </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. Simply change
<div><br></div>
<div> (self containOnlyOops: array1 and:
array2) ifFalse: [^false]</div>
<div><br></div>
<div>in ObjectMemory>>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 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"><<a href="mailto:reefedjib@yahoo.com" target="_blank">reefedjib@yahoo.com</a>></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: "Paolo Bonzini" <<a href="mailto:bonzini@gnu.org" target="_blank">bonzini@gnu.org</a>><br>To:
"The general-purpose Squeak developers list" <<a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>><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.
This<br>of course doesn't work. Is there an alternative that
would allow me to<br>do this?<br></blockquote><br>There's actually no
reason why the *destination* of a becomeForward:<br>cannot be a
SmallInteger. It'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. First off, this
will only work with<br> #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. There are
three steps:<br> 1) #prepareForwardingTableForBecoming:with:twoWay:
"create and init forwarding blocks, and install into original
headers"<br> 2) #mapPointersInObjectsFrom:to: "point pointers to
forwarded oop"<br> 3) #restoreHeadersAfterForwardBecome: "restore
original headers"<br>The question seems to come down to the following.
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>