<br><br><div class="gmail_quote">On Thu, Jul 22, 2010 at 5:14 PM, Andreas Raab <span dir="ltr"><<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On 7/22/2010 8:42 PM, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Eliot Miranda uploaded a new version of Kernel to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Kernel-eem.474.mcz" target="_blank">http://source.squeak.org/trunk/Kernel-eem.474.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-eem.474<br>
Author: eem<br>
Time: 22 July 2010, 1:42:05.4 pm<br>
UUID: 292f2cc5-ba81-4d03-a64f-4e7cb878d68f<br>
Ancestors: Kernel-eem.473<br>
<br>
BlockClosure>>#once Travis Griggs' neat idiom for interning values of computations. Use e.g. as in<br>
myResourceMethod<br>
^[time-consuming computation] once<br>
<br>
</blockquote>
<br>
What am I missing?<br>
<br>
Object compile: 'onceTest<br>
"Just once please"<br>
<br>
^[Transcript cr; show: ''only once''] once'.<br>
<br>
#(1 2 3) collect: #onceTest.<br></blockquote><div><br></div><div>...that I'm a complete moron. The VW implementation relies on "clean blocks" where the compiler creates a literal block provided the block doesn't reference its outer environment. The current closure compiler doesn't perform the optimization so it doesn't work; a new block is being created on each invocation of the method. A test that will work is e.g.</div>
<div><br></div><div> | b |</div><div> b := [Object new].</div><div> self assert: b once == b once</div><div> </div><div>So I need to do some work in the compiler and step back on my "Its portable" claim.</div>
<div><br></div><div>Eliot</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Cheers,<br><font color="#888888">
- Andreas<br>
<br>
</font></blockquote></div><br>