robertluo / fun-map

a map blurs the line between identity, state and function

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default wrappers can be configured by individual fun-maps

robertluo opened this issue · comments

Problem

Default wrappers are hard-coded now; the only way to change them for individual entries is by writing them everywhere.

I was curious about the wrappers system. I went digging through the code and the docs, but couldn't quite wrap my head around how to use the wrappers key most effectively. I'm finding "trace" adds to the fun of the fun-map quite a bit.

Let's see if I get where we are. In order to add a new default wrapper;

  1. you fork fun-map
  2. write a new type implementing ValueWrapper protocol
  3. add a new method to wrapper/fw-impl
  4. throw the dispatch key inside the fw macro itself?
    (helper/make-fw-wrapper wrapper/fun-wrapper [:trace :cache :newness] arg-map body)`

If I'm reading the code wrong, please let me know what I missed. If I'm up to speed, I'd like to work on solving this issue with you. Do you have any ideas?

You read the code correctly. It seems like there could be a more efficient way to implement this.