Fork me on GitHub
#clojure
<
2019-05-19
>
Drew Verlee01:05:28

I see the word "reified" come up a lot and sometimes in ways that makes me think i dont understand how its used, at least in the clojure community. 1. its a verb, so it acts on something and that action is to make it less abstract. I reified my health and wellness plan by signing up for the local gym. 2. reify, in clojure, does just that, it defines an anonymous type and creates an instance of that type. so when i see it used like this: > X uses a global singleton for the fact base; I wanted something reified I can pass around. I get confused. because im not sure how to interprate this, maybe they are saying that X only had the idea of a singleton, but they flushed out the implementation?

andy.fingerhut01:05:20

In the phrase "I wanted something reified I can pass around", it sounds like they want X to be a value that can be bound to a parameter, or returned as a value from a function call.

andy.fingerhut01:05:35

It would surprise me if everyone used the word "reify" identically to each other, BTW.

seancorfield01:05:31

reify does not "define an anonymous type". It creates an object that satisfies one or more interfaces or protocols.

Drew Verlee01:05:48

im out of my depth, but i am quoting the clojure docs directly: https://clojure.org/reference/datatypes#_reify

seancorfield04:05:00

Yeah, I think the "defines an anonymous type" is secondary to what it does. I mean, it has to "Because Java", but that's not really the point of reify. The important part is "creates an instance of ..." something that implements the specified protocols and interfaces (and IObj and IMeta).

👍 4
Drew Verlee19:05:11

yep makes sense, thanks sean

seancorfield01:05:26

(if that has to create a Java class that implements a bunch of things, that's an implementation detail)

seancorfield01:05:28

user=> (reify Runnable (run [this]))
#object[user$eval140$reify__141 0x546621c4 "user$eval140$reify__141@546621c4"]
user=> (type *1)
user$eval140$reify__141
user=> (ancestors *1)
#{java.lang.Runnable clojure.lang.IObj java.lang.Object clojure.lang.IMeta}
user=>    

seancorfield01:05:49

It hadn't occurred to me that it would implement IObj and IMeta but that makes sense...

penryu04:05:35

Yeah, I found the same thing when debugging last week. Not expected, but reasonable.

Drew Verlee02:05:55

interesting, thanks @seancorfield, that makes sense. i think @andy.fingerhut is right here and it might have been a slight mis-use on the original authors part. Normally i dont get tripped up on such things but I wasnt comfortable with reify yet so its hard to see where the misconception is.

rickmoynihan08:05:56

I think their usage is correct if you read it as reified as a value.

Bravi19:05:36

I’m trying to call a server from my clojure app using http-kit + enlive. I’m basically trying to scrape a single page daily, but that page is JS rendered. Is there a way to somehow wait for javascript to render the page?

lilactown19:05:33

you’ll have to use a headless browser like chromium

lilactown19:05:28

I believe there’s a Clojure library for doing this: https://github.com/igrishaev/etaoin

Bravi19:05:29

thank you 🙂