What are the disadvantages of using the syntax || = to perform memoization

I noticed that some people comment on how their use ||= to perform memoization was "sloppy", but they did it anyway "because they were in a hurry."

I also found ActiveSupport :: Memoizable .

I came to the conclusion that ||= has flaws.

And what are they?

+4
source share
2 answers

Well, the biggest reason I know about is because you cannot memoize nil or false values โ€‹โ€‹like this.

+5
source

Source: https://habr.com/ru/post/1369579/


All Articles