memoist icon indicating copy to clipboard operation
memoist copied to clipboard

Allow operator methods to be memoized

Open dark-panda opened this issue 6 years ago • 9 comments

Memoizing operators will raise a syntax error due to the operator symbols being injected into the eval'd code. We can allow operator memoization by using some mangled names instead. To (hopefully) avoid clashing with any existing method names, we've added some underscores to the names and upper-cased them.

dark-panda avatar Nov 28 '18 15:11 dark-panda

Yeah, looks like older versions of Ruby aren't fans of that hash syntax. I'll fix these up and reroll shortly, shouldn't be a problem.

dark-panda avatar Nov 29 '18 15:11 dark-panda

Re-rolled and fixed

dark-panda avatar Nov 29 '18 23:11 dark-panda

Very nice! @matthewrudy Please review.

pboling avatar Nov 30 '18 01:11 pboling

Any chance on this getting merged, @matthewrudy?

dark-panda avatar Apr 03 '19 17:04 dark-panda

ping @matthewrudy 👍

pboling avatar Apr 12 '19 23:04 pboling

Been a year now, figured I'd check in.

dark-panda avatar Dec 09 '19 16:12 dark-panda

It's that time of year again. Just checking in on my PR.

dark-panda avatar Nov 30 '20 19:11 dark-panda

@dark-panda Matthew, the owner of this repo, died in 2019. I just found out. I have created a new org in his memory, called memoist. I'm adding you to it (don't have to accept if you'd rather not).

pboling avatar Jun 05 '22 11:06 pboling

FYI: Added this alert to the new memoist repo

[!IMPORTANT]

Recommendation

Consider using MemoWise instead, as it is maintained, fully tested, provides thread safety guarantees, and is much, much faster.

Other Alternatives

In case you need a tool with this feature set that is currently maintained, check out:

  • https://github.com/makandra/memoized
  • https://github.com/honzasterba/memoist
  • https://github.com/AlexWayfer/alt_memery

[!TIP]
Seriously though, read the important note above.

[!WARNING]
If you must continue - be aware that this is unmaintained software.

pboling avatar Jun 04 '24 07:06 pboling