The challenge I guess is figuring out how variables captures by lambdas should be dealt with.
The challenge I guess is figuring out how variables captures by lambdas should be dealt with.
It's great, one of the many awesome features Clojure has.
I didn't see links on that page, but IIRC, there's a particular paper they reference as the main idea.
It provides the opposite: a mutable CoW data structure that is extremely cheap to "fork" so that all subsequent updates occur only on the new "fork" and are invisible to the old "fork".
- Use the data structure as a "standard" tree, sharing one instance across threads and use locking for thread-safety
- Use it as a fully-persistent structure by calling "Fork" before every modification
- Or anything in between
I needed the 3rd case: a cache manager gives out a forked view of the actual cache contents to its clients. Thus the cache is always in control of the "master" copy, and if a client modifies its own fork, the cache and other clients are not affected.
Yes, many languages (and libs, e.g. for JS) do that.