yada

grav 2017-11-01T21:12:42.000226Z

The way yada uses Records (and maybe all uses of Records) seems magical to me. When calling a response fn, it wraps the ctx in a Response record, and if you merge the correct way (or assoc), you get to control status code, etc. If you donโ€™t merge the correct way, you get a hashmap as the body. Is this idiomatic Clojure?

malcolmsparks 2017-11-01T21:22:11.000088Z

It's a tradeoff. The problem in Liberator was in determining if the user was returning a map or actually a Ring response. Namespaced keys might be a better approach.

malcolmsparks 2017-11-01T21:22:43.000016Z

I agree, the approach in yada isn't idiomatic

malcolmsparks 2017-11-01T21:22:52.000238Z

But records are useful

malcolmsparks 2017-11-01T21:23:11.000567Z

They have Rich's seal of approval ๐Ÿ˜Š

dominicm 2017-11-01T21:28:45.000030Z

@grav what's the incorrect way to merge?

grav 2017-11-01T21:33:15.000458Z

(defrecord Foo [])
(instance? Foo (merge (Foo.) {})) ;; => true
(instance? Foo (merge {} (Foo.))) ;; => false

grav 2017-11-01T21:33:48.000039Z

@dominicm ^

grav 2017-11-01T21:35:19.000305Z

@malcolmsparks Haha, yes they have. Since 1.2 as I read it. Maybe heโ€™s changed his mind since then ๐Ÿ˜‰

grav 2017-11-01T21:35:45.000129Z

But I certainly see the dilemma wrt map vs Ring response