[Seaside] Importing halo's from Monticello

Bert Freudenberg bert at impara.de
Sat Jun 4 01:47:49 CEST 2005


Am 04.06.2005 um 01:34 schrieb Avi Bryant:
>
>>> myObject
>>> |cache|
>>> cache := #(nil).
>>> ^ cache first ifNil: [cache at: 1 put: '..............'  
>>> reconsituteObject]

> My original version of that method was even nastier, in that it relied
> on the fact that the compiler collapses literals that are #= (and
> thus, "#(nil) == #(nil)" will evaluate to true).  It was this:
>
> ^ #(nil) first ifNil: [#(nil) at: 1 put: .....]

Perhaps this would be a bit more readable:

^#(nil) firstIfNilPut: [......]

defining Array>>firstIfNilPut: like this:

firstIfNilPut: aBlock
     ^self first ifNil: [self at: 1 put: aBlock value]


- Bert -



More information about the Seaside mailing list