@@ -36,26 +36,37 @@ fMemo(3); // Does not print anything. Returns 6.
36
36
```
37
37
38
38
## Unresolved questions
39
+
40
+ ### Issue 2:
41
+ Should ` memo ` be a prototype method, a static function, a function decorator,
42
+ or multiple things?
43
+
44
+ ### Issue 3:
39
45
How should cache garbage collection work? (Using WeakMaps for the caches would
40
- be ideal…except that WeakMaps do not support primitives as keys.) Should we
41
- just use Maps and make the developer manage the cache memory themselves? This
42
- problem is unresolved.
46
+ be ideal…except that WeakMaps do not support primitives as keys.)
47
+
48
+ Should we just use Maps and make the developer manage the cache memory
49
+ themselves? (See also [ LRUMap and LFUMap] [ ] .)
43
50
51
+ There is also the [ compositeKeys proposal] [ ] .
52
+
53
+ [ LRUMap and LFUMap ] : https://github.com/js-choi/policy-map-set
54
+ [ compositeKeys proposal ] : (https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey)
55
+
56
+ ### Issue 4:
44
57
If we go with a Map cache, how should we structure the cache? For example, we
45
58
could use a tree of Maps, or we could use argument-[ tuples] [ ] as keys in one
46
59
Map.
47
60
48
61
[ tuples ] : https://github.com/tc39/proposal-record-tuple
49
62
63
+ ### Issue 5:
50
64
Should we add an LRUMap ([ least recently used] [ ] ) to the language, like
51
65
[ Python’s lru_cache] [ Python functools.lru_cache ] ? If so, should it be added
52
66
with this proposal?
53
67
54
68
[ least recently used ] : https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
55
69
56
- Should ` memo ` be a prototype method, a static function, a function decorator,
57
- or multiple things?
58
-
59
70
## Precedents
60
71
61
72
* [ lodash.memoize] ( https://lodash.com/docs/4.17.15#memoize )
0 commit comments