Fork me on GitHub
#beginners
<
2019-01-11
>
drone01:01:36

for projects with many namespaces that share a set of defrecords, is the convention to place the record definitions in their own namespace to avoid circular references amongst namespaces?

drone01:01:07

I think that generally signals poor organization, but let’s assume (I believe this is true) there are some valid situations where it’s a problem

Mario C.01:01:43

Is ring an interface between my web app and the network card?

drone01:01:26

I suppose for some definition of interface

Mario C.01:01:48

>abstracting the details of HTTP

Mario C.01:01:00

What does this mean?

Mario C.01:01:24

What would I need to do had I not used Ring?

drone01:01:13

it’s been a looong time since I’ve used ring, but I imagine they’re referring to is processing of requests and responses is abstracted as a pipeline of functions

hiredman01:01:37

ring is really a standard interface between http servers and clojure functions

hiredman01:01:53

so the alternative is to use the native interface of whatever http server

hiredman01:01:59

or to write your own http server

hiredman01:01:46

for example, there is ring-jetty-adapter, which takes jetty's interface and adapts it to ring, so it can response to an http request by invoking a clojure function

hiredman01:01:33

you could also use jetty's interface directly, or servlets (which is sort of a java standard interface to http servers)

hiredman01:01:19

there are something like a million layers between your code and your network card

Mario C.01:01:30

Is there a standard HTTP server?

Mario C.01:01:37

is clj-http

henrik06:01:07

You can have a look at http-kit. It works as both client and server: http://www.http-kit.org/

hiredman01:01:49

clj-http is an http client

Mario C.01:01:51

the http server my app uses if its in my project.clj

hiredman01:01:54

and is one of many

hiredman01:01:08

clj-http doesn't come with an http server

Mario C.01:01:48

So Jetty and Undertow are http severs? Not web servers?

Mario C.01:01:18

are these terms used interchangeably

hiredman01:01:55

in so much as the "web" is a concrete thing and not just a buzzword, it is a bunch of servers serving http to clients

Vincent Cantin03:01:57

Is there a library equivalent to Selmer which is also working in Clojurescript?

Daouda04:01:25

hey guys, i am trying to deref a variable from another namespace domain/@variable. Is this possible?

seancorfield04:01:57

@domain/variable

seancorfield04:01:21

Because the symbol is domain/variable and @ is shorthand for (deref …)

Daouda04:01:33

thanks 🙂

arnoha15:01:40

is there a way to re-load the project level deps.edn without having to restart the REPL?

Alex Miller (Clojure team)15:01:12

that’s used to build the classpath that the JVM is started with

Alex Miller (Clojure team)15:01:24

and you can’t change the classpath dynamically

Alex Miller (Clojure team)15:01:53

(classloaders can be made to do this though and some tools like boot can do so via pods)

Alex Miller (Clojure team)16:01:32

for the more specific case of just adding a library, that’s something we have prototyped with deps.edn and I expect it will eventually be “in the box”

parrot 20
samcgardner23:01:09

Luminus has generated code as follows for a new project, which doesn't compile:

(defstate ^:dynamic *db*
          :start (conman/connect! {:jdbc-url (env :database-url)})
          :stop (conman/disconnect! *db*))
What should this look like?

noisesmith23:01:27

what's the specific error?

samcgardner23:01:08

Syntax error compiling at (form-init14274565493373859375.clj:1:1).

samcgardner23:01:23

oops that's huge

samcgardner23:01:17

https://pastebin.com/KQDrDuHm if you'd like to see the offending code in context

noisesmith23:01:18

the full stack trace is likely more useful than the code here - you can use *e in a repl to get the trace if it was hidden

👍 5
samcgardner23:01:16

user=> *e
#error {
 :cause "Unable to resolve symbol: defstate in this context"
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message "Syntax error compiling at (/tmp/form-init14274565493373859375.clj:1:1)."
   :data #:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source "/tmp/form-init14274565493373859375.clj"}
   :at [clojure.lang.Compiler analyze "Compiler.java" 6808]}
  {:type java.lang.RuntimeException
   :message "Unable to resolve symbol: defstate in this context"
   :at [clojure.lang.Util runtimeException "Util.java" 221]}]
Well, I guess that's pretty obvious. Thanks for the tip, didn't know about that!

🍻 5
temco16:01:03

it seems that this clj-file is lack of a require of "mount", which is required in the project.clj like [mount "0.1.15"]