clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
2020-09-05T11:42:20.160600Z

Morning

dominicm 2020-09-05T12:14:04.160900Z

https://clojurians.slack.com/archives/CBJ5CGE0G/p1599246728158100 Have you used ring?

😂 1
borkdude 2020-09-05T12:46:26.162Z

@dominicm What distinguishes maps from other "pure data" values passed in a positional fashion that they would lead you to global state? That doesn't seem to be inherent to maps to me.

dominicm 2020-09-05T12:48:01.162700Z

@borkdude I guess the ability to name them.

borkdude 2020-09-05T12:48:49.163Z

so naming instead of positional indexing leads to global state, in what world?

dominicm 2020-09-05T12:53:20.165800Z

Ah, if I'm completing the sentence "leads to global state", it's "passing a map to every function in your program leads to global state". Global state isn't only bad because it's touched by simultaneous unrelated processes (like threads) it's also bad because a programmer cannot keep all of the values I their head.

borkdude 2020-09-05T12:59:59.167200Z

You don't have to convince me that global state is not ideal in a lot of cases. I just don't see why passing maps {:foo 1 :bar 2} leads to global state where-as passing [1 2] doesn't.

borkdude 2020-09-05T13:03:47.167600Z

If you mean that persistent maps lead to Datomic, the one true global state, then yes, you're right

dominicm 2020-09-05T15:18:24.172200Z

Maybe I'm not expressing this well. Imagine you have a map, {:config-file "foo.edn`"}.` You call (`read-config)` on it, that merges the config into it. Then you call another function. You never call + directly, but instead you call add-user-times which takes that map, gets the user times from known keys, adds them together and puts them in a new key. This is global state.

raymcdermott 2020-09-05T16:27:40.176300Z

IMHO global state is not so bad, shared mutable state is the bad part. Programs that have a the need to read from a central context map (like a web middleware) can be OK. Yada relies heavily on this approach. What's wrong with it?