[Pharo-dev] memoized vs once

Torsten Bergmann astares at gmx.de
Wed Jan 25 17:45:54 EST 2017


>From my perspective:

- I agree with Igor that "once" can be interpreted as "evaluate it only once" as in 
  "Halt once". 

- I'm not sure but from the (now very distributed) discussion it is not clear to me if 
  the #once mentioned by Eliot really has exactly the same behavior as #memoized in Pharo.

  Does it also  return a block that is caching the results and avoids a second evalution 
  of the original block when having similar inputs? Also is there a similar possibility 
  to give an own cache as in #memoizedUsing: for further tuning?

- #memoizing is really not well explaining what it does but this seems to be the official
  term (also in other languages like Python, Java, JS, ...): https://en.wikipedia.org/wiki/Memoization

- maybe #withMemo(r)izingResults or #withCachingResults, #withReusedResults, ... or something along that line
  would be more intention revealing selectors

Side note:
- For license reason it would not make much sense to look into non-open Smalltalks
- I have no idea about the VW version (and for obvious reasons dont want to have a look)
- also dont know about other dialects if they have built in support for memoization but it would be
  good if Squeak, Pharo, Cuis, ... could align for such a case
- IMHO if #once and Pharos #memoization really have the same behavior then compatibility for VW users
  could be easily retained by adding #once to existing compatibility layers (like "Grease")


Gesendet: Mittwoch, 25. Januar 2017 um 22:30 Uhr
Von: "Igor Stasenko" <siguctua at gmail.com>
An: "Pharo Development List" <pharo-dev at lists.pharo.org>
Betreff: Re: [Pharo-dev] memoized vs once

#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.

More information about the Pharo-dev mailing list