Nothing new, that's the term. Memoization: After computing a solution to a subproblem, store it in a table. Subsequent calls check the table to avoid redoing work. https://en.wikipedia.org/wiki/Memoization http://www.cas.mcmaster.ca/~deza/6_Dynamic++.pdf http://wiki.tcl.tk/10779 I have been using the method for something else, caching costly REST calls. getIssueCreateMeta "Retrieves the metadata for all types of issues. Fields are expanded" ^ self isMemoizingMeta ifTrue: [ ([ :ignored | self getIssueCreateMetaWithExpandKeys: true ] memoizedUsing: self cache ) value: #issueCreateMeta ] ifFalse: [ self getIssueCreateMetaWithExpandKeys: true ] using: cache ^ cache ifNil: [cache := LRUCache new maximumWeight: self defaultCacheWeight ] It is nice to see the cache hit rate etc in the inspector. BTW I am interested to see how one coul dwrite the code above without repeating the block. Also, :ignored is not used by the method but is the cache key. Phil On Wed, Jan 25, 2017 at 10:30 PM, Igor Stasenko <siguctua@gmail.com> wrote:
#once can be interpreted as 'evaluate it once',
but i don't like the #memoized .. it sounds painful to my ears. It sounds like something stinking smeared across my face.. and i always got stuck,confused and lost as the meaning of it always escaping my mind, since it naturally defends itself from any unpleasant thoughts.
IMHO, maybe #once is not the best wording for what it does , but #memoizing... yuck.. pardon me.
:)
-- Best regards, Igor Stasenko.