Closed bn-darindouglass-zz closed 3 years ago
Drafted #28
Hi Darin,
Thank you for your elaborate message and the PR. It's interesting that you want said "delay-based" or "lazy" functionality, because if you have a look at the 3.x branch, there you'll see a feature called *lazy-mode*
that can be turned on. I believe this does exactly what you are after. It does not have the locking
from your PR yet, so I will need to add that.
However, 3.x is not released yet. While working on it, I wanted to see how I could reimagine mount-lite by solely relying on this delay-like behaviour. This became the redelay library (and it has the locking
😉 )
So, as I see it, there are several ways you forward here:
Let me know where you stand on this. I'll review your PR anyway.
Interesting, thanks for getting back to me.
1) We'll give redelay
a look. We use explicit deps primarily for the only-start-what-i-care-about functionality as well as for the documentation it provides. It's not a game-breaker in any way but definitely a nice to have.
2) Yeah we swapped to mount.lite
because of explicit deps. We have some state that's poorly handled/implemented with mount and ran into problems several times where mount/start
ing our system started things that we didn't actually care about which caused confusion and failing tests.
From the look of things redelay
is fills the exact use-case we're looking for. Thanks for the heads up on that.
As for my PR, given 3.x is "if and when" instead of "when" it may make sense to get it through so the behavior is available for those who use mount.lite
instead of redelay
.
Closed by #28.
During some internal discussions about state management, my team weighed the benefits of a simple
delay
-based state solution vs using mount.lite to manage state.One argument for the
delay
-based approach was everything was started automatically on first use which generally simplifies work in the repl during development.After some thought, we found a middle-ground that we figured may be nice to include in the upstream library as a new extension:
mount.extensions.autostart
.This extension provides a new
defstate
which wraps the mainmount.lite.State
with a new record that will auto-start on first deref. The start fn it'll use is configurable (we usemount.extensions.explicit-deps/start
, but it defaults to standardmount.lite/start
).Here's our code.
Any thoughts? We wanted to gauge interest before submitting a PR against the upstream library.