[squeak-dev] Re: The Trunk: Kernel-eem.474.mcz
Eliot Miranda
eliot.miranda at gmail.com
Fri Jul 23 01:26:11 UTC 2010
On Thu, Jul 22, 2010 at 5:14 PM, Andreas Raab <andreas.raab at gmx.de> wrote:
> On 7/22/2010 8:42 PM, commits at source.squeak.org wrote:
>
>> Eliot Miranda uploaded a new version of Kernel to project The Trunk:
>> http://source.squeak.org/trunk/Kernel-eem.474.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Kernel-eem.474
>> Author: eem
>> Time: 22 July 2010, 1:42:05.4 pm
>> UUID: 292f2cc5-ba81-4d03-a64f-4e7cb878d68f
>> Ancestors: Kernel-eem.473
>>
>> BlockClosure>>#once Travis Griggs' neat idiom for interning values of
>> computations. Use e.g. as in
>> myResourceMethod
>> ^[time-consuming computation] once
>>
>>
> What am I missing?
>
> Object compile: 'onceTest
> "Just once please"
>
> ^[Transcript cr; show: ''only once''] once'.
>
> #(1 2 3) collect: #onceTest.
>
...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.
| b |
b := [Object new].
self assert: b once == b once
So I need to do some work in the compiler and step back on my "Its portable"
claim.
Eliot
>
> Cheers,
> - Andreas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100722/b9254758/attachment.htm
More information about the Squeak-dev
mailing list
|