Skip to content

Commit 29fc838

Browse files
committed
explainer: Expand § unresolved questions
See #2, #3, #4, and #5. Closes #1 in favor of #3.
1 parent 9b9c386 commit 29fc838

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,37 @@ fMemo(3); // Does not print anything. Returns 6.
3636
```
3737

3838
## 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:
3945
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][].)
4350

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:
4457
If we go with a Map cache, how should we structure the cache? For example, we
4558
could use a tree of Maps, or we could use argument-[tuples][] as keys in one
4659
Map.
4760

4861
[tuples]: https://github.com/tc39/proposal-record-tuple
4962

63+
### Issue 5:
5064
Should we add an LRUMap ([least recently used][]) to the language, like
5165
[Python’s lru_cache][Python functools.lru_cache]? If so, should it be added
5266
with this proposal?
5367

5468
[least recently used]: https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
5569

56-
Should `memo` be a prototype method, a static function, a function decorator,
57-
or multiple things?
58-
5970
## Precedents
6071

6172
* [lodash.memoize](https://lodash.com/docs/4.17.15#memoize)

0 commit comments

Comments
 (0)