[squeak-dev] Re: The Trunk: Kernel-eem.474.mcz

Travis Griggs travisgriggs at gmail.com
Fri Jul 23 04:21:58 UTC 2010


On Jul 22, 2010, at 7:57 PM, Andreas Raab wrote:

> On 7/22/2010 6:26 PM, Eliot Miranda wrote:
>> The VW implementation relies on "clean
>> blocks" where the compiler creates a literal block provided the block
>> doesn't reference its outer environment.
>
> I see. Sounds like a hack :-) What's wrong with the straightforward:
>
> someResource
> 	^SomeResource ifNil:[self initializeSomeResource]
>
> ? It explicitly documents that there is a shared resource by naming  
> it which is a good thing in my understanding.


The genesis of them (once blocks) is described in gory fireside chat  
detail here:

http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&printTitle=When_You_Come_Back&entry=3346567529

I later did a boring screencast showing a common use of them  
integrated into the VW IDE:

http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&printTitle=Assets&entry=3358066923

We actually use them quite a bit.

If reading the above, what once blocks bring to the picture, is  
basically something similar to compile time expressions. Or at least,  
there's a large overlap of where a once block provides similar  
advantages to a CTE. There's actually some benefits to doing it with  
once blocks vs CTEs, for some cases. And I'm sure there's some places  
where CTE's would be better.

--
Travis Griggs
Objologist
"Some people are like slinkies, not really good for much, but they can  
bring a smile to your face when you push them down the stairs."




More information about the Squeak-dev mailing list