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

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Fri Jul 23 20:29:02 UTC 2010


2010/7/23 Levente Uzonyi <leves at elte.hu>:
> On Fri, 23 Jul 2010, Tobias Pape wrote:
>
>>
>> Am 2010-07-23 um 07:39 schrieb Andreas Raab:
>>>
>>> However, I do take Travis' point about compile time expressions. Here the
>>> whole point is that you really want the expression to be reevaluated when
>>> the defining code changes which is not easily done the above (it's possible
>>> but bothersome).
>>
>> I think its good to point out that it is possible to
>> differentiate between one-time-expressions
>> and compile-time expressions. I think an expression
>> executed once, however, not at compile time can make
>> a pretty good lazy initializer in the sense you mentioned.
>>  Alas, I must admit that I?m not aware of an example that
>> cannot be equally good expressed with the ?ifNil: variant
>> as with the [] once  variant.
>
> Seaside 2.8 uses a literal array with a single element for this to cache
> files. It works something like this:
>
> fooFile
>
>        | array |
>        array := #(nil).
>        ^(array at: 1) ifNil: [
>                array at: 1 put: 'alongbase64string' decodeBase64 ]
>
> These selectors are auto-generated. I think #once is (would be) a better
> solution. It could be hardly done with class (instance) variables.
>
>
> Levente
>

Hmm I did same trick long time ago...
How do they have it working in VW with immutable literals ?

Nicolas

>>
>>
>> So Long,
>>        -Tobias
>>
>
>



More information about the Squeak-dev mailing list