juxt

malcolmsparks 2016-04-20T11:00:14.000002Z

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.

malcolmsparks 2016-04-20T11:00:28.000003Z

Also, see the README on the branch for more explanation

malcolmsparks 2016-04-20T11:01:02.000004Z

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

gardnervickers 2016-04-20T12:38:29.000005Z

@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}

malcolmsparks 2016-04-20T13:18:49.000006Z

@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)

gardnervickers 2016-04-20T13:19:21.000007Z

Agreed

malcolmsparks 2016-04-20T13:19:43.000008Z

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

malcolmsparks 2016-04-20T13:20:12.000009Z

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

malcolmsparks 2016-04-20T13:20:56.000010Z

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?

malcolmsparks 2016-04-20T13:22:55.000011Z

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

malcolmsparks 2016-04-20T13:23:04.000012Z

results in

malcolmsparks 2016-04-20T13:23:08.000013Z

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

malcolmsparks 2016-04-20T13:23:55.000014Z

ah, I see, that's wrong

malcolmsparks 2016-04-20T13:24:04.000015Z

it should be

malcolmsparks 2016-04-20T13:24:32.000016Z

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

malcolmsparks 2016-04-20T13:36:51.000017Z

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

malcolmsparks 2016-04-20T13:37:39.000018Z

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

malcolmsparks 2016-04-20T13:37:56.000019Z

I'll do a 1.0.0-beta1 I think

gardnervickers 2016-04-20T14:43:25.000020Z

Ok

malcolmsparks 2016-04-20T23:08:11.000021Z

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

malcolmsparks 2016-04-20T23:08:19.000022Z

Deployed to clojars as 1.0.0-beta2

malcolmsparks 2016-04-20T23:08:37.000023Z

I've added a test for your example:

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

malcolmsparks 2016-04-20T23:08:44.000024Z

Seems to work 😉

malcolmsparks 2016-04-20T23:09:45.000025Z

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

malcolmsparks 2016-04-20T23:38:32.000027Z

temp fix applied