mount

tolitius 2016-02-22T15:06:31.000027Z

@taylor.sando: good point. there is definitely a limitation on composability that I working on at the moment: https://github.com/tolitius/mount/issues/47 I like try not to add new locking API, and focus on composing things. for example here is what I am thinking about:

(-> (only 1 2 3)
    (with-args {})
    (except 2 1)
    (swap {2 42 1 34})
    (mount/start))

tolitius 2016-02-22T15:08:40.000030Z

btw, as of 0.1.9 mount has both start-with and start-with-states

2016-02-22T15:09:09.000033Z

The only problem is that you have to choose one or the other, unless there's a way around that

tolitius 2016-02-22T15:09:38.000034Z

correct, they do not compose, which is a problem I am going to address with #47 :simple_smile:

tolitius 2016-02-22T15:10:49.000035Z

what do you think about:

(-> (only 1 2 3 4)
    (with-args {})
    (except 2 1)
    (swap-states {4 #'foo.bar/5})
    (swap {2 42 1 34})
    (mount/start))

tolitius 2016-02-22T15:12:25.000036Z

as a temp workaround you can have test states (that would create values you need), and use them along with real states via start-with-states

tolitius 2016-02-22T15:13:09.000037Z

another "reverse" way is to use that datomic connection as a value

tolitius 2016-02-22T15:13:18.000038Z

and close it / clean it at the end of the test

tolitius 2016-02-22T15:13:25.000039Z

(i.e. could be in fixture)

tolitius 2016-02-22T15:16:12.000040Z

any way you go, I'd like to know what worked / did not work for you :simple_smile:

2016-02-22T15:18:36.000041Z

Well for a 0.2.0 release, a way to explicitly state which states you want to use, and then the ability to provide state and value replacements

tolitius 2016-02-22T15:21:15.000042Z

that's what I am thinking by:

(-> (only 1 2 3 4)
       (swap-states {4 #'foo.bar/5})
       (swap {2 42 1 34})
       (mount/start))
is that what you are looking for?

2016-02-22T15:22:51.000047Z

Would only, swap-states and swap be defined in mount.core?

tolitius 2016-02-22T15:23:09.000049Z

yep

2016-02-22T15:24:02.000050Z

Would it be building up a map then?

2016-02-22T15:25:01.000051Z

You could potentially keep start-with, and create a new start-using so that you don't have to overload start/with

tolitius 2016-02-22T15:25:02.000052Z

more like a set

tolitius 2016-02-22T15:26:30.000053Z

yea, the old API would not change, and the start takes states since day one

tolitius 2016-02-22T15:27:07.000054Z

the idea is to have as few API as possible :simple_smile:

tolitius 2016-02-22T15:28:06.000055Z

and once they are composable, there is only going to be a need in start and stop that optionally take vararg states (the way they already do)

2016-02-22T15:28:32.000057Z

I guess the swap-states and swaps would just be side effecting like start-with-states and start-with is now

tolitius 2016-02-22T15:29:13.000058Z

right, for yurt it would not matter since all of it is going to be detached once the yurt is built

tolitius 2016-02-22T15:29:45.000060Z

for mount no changes from the way it works now

tolitius 2016-02-22T15:30:22.000061Z

i.e. which one to use would mostly depend on personal preferences and the development flow

tolitius 2016-02-22T15:32:44.000062Z

it is interesting that you want both swap-states and swap.. I was contemplating on removing start-with-states, since in tests values work better, and most of the real states have their start / stop functions live separate, hence can be reused to create / destroy those values

tolitius 2016-02-22T15:33:36.000063Z

is there any reason just values (i.e. the current start-with behavior) won't work for you?

2016-02-22T15:34:37.000064Z

Seems like it would be easier to manage the start/stop then using values and fixtures

tolitius 2016-02-22T15:34:55.000065Z

yea, that was my thinking

tolitius 2016-02-22T15:35:05.000066Z

oh.. read it wrong

tolitius 2016-02-22T15:35:23.000067Z

my thinking was reverse :simple_smile:

tolitius 2016-02-22T15:35:51.000068Z

in any case I'll keep both

tolitius 2016-02-22T15:37:09.000069Z

in the meantime would a couple of workarounds above work for you?

2016-02-22T15:38:08.000071Z

I'm just using my workaround for now

tolitius 2016-02-22T15:38:51.000072Z

ok, sounds good. I'll let you know once the composable approach is in

arnout 2016-02-22T20:50:20.000075Z

@taylor.sando: You might like https://github.com/aroemers/mount-lite. You won't have the issue with dev states starting with it (substitutions are "anonymous" to mount-lite), all the start options are composable via data (and have composable convenience functions), and substitutions have lifecycle expressions.

arnout 2016-02-22T20:52:55.000077Z

@taylor.sando: not to ditch mount at all though, I know @tolitius is working on your issues as well.