Fork me on GitHub
#juxt
<
2016-04-20
>
malcolmsparks11:04:14

hi @gardnervickers I've spent some time this morning having a more thorough review of your aero changes. I've been able to replicate most of the functionality of transforms without needing the abstraction and I feel that transforms, while useful, can be explicitly achieved by the user outside of aero. Anyway, I've created a branch (gardner) with a number of commits on that explain my thinking here. I've also renamed #cond to #profile and done some other work. I think I've mostly been able to keep the functionality you've added.

malcolmsparks11:04:28

Also, see the README on the branch for more explanation

malcolmsparks11:04:02

I'd appreciate your thoughts and comments - I don't need to merge this to master urgently so we've got some time to mull it over

gardnervickers12:04:29

@malcolmsparks: I think I like this new approach a lot better, we’ve seen arbitrary transforms make it too tempting to write what should be code in edn. One more addition I’d like to make is that if the ^:ref resolution ends on a map/list/vector we run the postwalk step on it again, this is because ^:ref is not recursive unless it ends on another ^:ref. This will not resolve correctly currently.

{:user ^:ref [:gardner]
 :gardner {:favorite-color ^:ref [:color]}
 :color :blue}

malcolmsparks13:04:49

@gardnervickers: the problem with encouraging applications to post-process config is that it then makes the configuration not 'readable' in its own terms - one has to know both Aero and how the application is processing the config to reason about configuration. If you're only supporting one app, that's fine. But what if you're supporting many such applications (as happens in larger orgs)

malcolmsparks13:04:43

We've had some difficulties with systems that do clever things, like compute port numbers, which while clever (avoiding port conflicts), make reasoning about the configuration much harder

malcolmsparks13:04:12

I think configuration should be something (ideally) that one can reason about (in its own terms) rather than have to reason about the entire system as a whole - well, that's the aspiration

malcolmsparks13:04:56

I'm trying to figure out your point about the snippet not resolving - not quite sure I follow your point about rerunning the postwalk, can you explain again?

malcolmsparks13:04:55

(read-config (new java.io.StringReader
                  "{:user ^:ref [:gardner]
                    :gardner {:favorite-color ^:ref [:color]}
                    :color :blue}"))

malcolmsparks13:04:08

{:user {:favorite-color [:color]}, :gardner {:favorite-color :blue}, :color :blue}

malcolmsparks13:04:55

ah, I see, that's wrong

malcolmsparks13:04:32

{:user {:favorite-color :blue} ...}

malcolmsparks13:04:51

I'm struggling to implement this - I'm going to leave it as a TODO

malcolmsparks13:04:39

I'm thinking of removing the deprecated stuff and just going with a 1.0.0

malcolmsparks13:04:56

I'll do a 1.0.0-beta1 I think

malcolmsparks23:04:11

I've fixed the issue by doing a postwalk twice - not quite sure why that works but I've tested it on a few cases and it seems to work

malcolmsparks23:04:19

Deployed to clojars as 1.0.0-beta2

malcolmsparks23:04:37

I've added a test for your example:

(read-config (new java.io.StringReader "{:user ^:ref [:gardner] :gardner {:favorite-color ^:ref [:color]} :color :blue}")) `

malcolmsparks23:04:44

Seems to work 😉

malcolmsparks23:04:45

We're using aero on https://juxt.pro and I must say it's getting quite a workout!

malcolmsparks23:04:32

temp fix applied