Fork me on GitHub
#clojure-dev
<
2018-11-09
>
mfikes12:11:55

I just deleted several posts by that userid.

👍 4
Alex Miller (Clojure team)12:11:55

Thx, I removed their ability to post

mpenet16:11:20

just curious, why no "undatafy" (naming is hard heh)?

Alex Miller (Clojure team)16:11:13

Why you would want to move out of data?

Alex Miller (Clojure team)16:11:24

You’ve already won :)

mpenet16:11:51

rubber duck "feature requesting"

mpenet16:11:08

in which I destroy my own arguments for a request while describing it

dominicm19:11:43

So that I can take a thing and then modify it, then return it back to the Java library that gave it to me.

Alex Miller (Clojure team)19:11:35

That’s not a goal of datafy

dominicm20:11:19

Sure. But that's a why.

Alex Miller (Clojure team)21:11:21

there’s a contrib library for this already - https://github.com/clojure/java.data. This is not the goal of datafy

mpenet16:11:41

turning data into Foo

mpenet16:11:28

ex a ring request map into a ServletRequest (or whatever jetty takes for instance).

mpenet16:11:21

It would be tricky to know how to dispatch the value efficiently, I guess that's an over-generalisation of this kind of need

mpenet16:11:44

another one: Wouldn't a second arity to datafy be handy? (defprotocol Datafiable (datafy [x] [x opts])) , ex: for potential options to the transformation (keywordize?, codec, whatnot, etc)

Alex Miller (Clojure team)16:11:32

You can pass custom functions, the ultimate option handler

mpenet16:11:14

Yeah the obvious simple solution

bronsa16:11:19

why nos are not usually good questions to ask :)

didibus20:11:05

Yup, the answer is almost always because we don't care.

mpenet16:11:03

here 😛

👍 4
mpenet16:11:11

It's just a wording change, but you get the idea

mpenet16:11:24

That proposal seems quite harmless and could actually add some value (I think). I was playing with transforming some java instance that represent a (java class) Response from Elasticsearch (with a json body basically) and sometimes you might not want keywordization for instance. I have the feeling that's a need that could be quite common

mpenet16:11:54

I have another concrete example with "recordsets" instances that could take a number of options too

mpenet16:11:35

... or maybe it's not what datafy was designed to do.

ghadi16:11:08

the default answer is that it can always be added in the future. My suspicion is that Datafiable is for a particular usecase that doesn't have knobs

ghadi16:11:18

AKA the last thing you said 🙂

mpenet16:11:51

having a single arity makes it also "universal" you can just call it blindly and expect something in return, 2 arity: you need to either know what to call, or have extenders always specify the 2

ghadi16:11:06

also calling it recursively