Fork me on GitHub
#beginners
<
2018-01-14
>
rcustodio19:01:41

Hi… Can any1 give me an example of some code where aot would be really bad?? I never had problem with that, but ppl keeps sayin that is bad

rcustodio19:01:04

Its hard to explain for ppl in my company, without an example, and i dont have any

noisesmith19:01:51

if you use aot in a library, you bake in your deps, and force those versions on you library's users

alexmiller19:01:43

I don’t think this is really accurate

alexmiller19:01:26

You do increase your dependency on a particular version of the Clojure compiler

noisesmith19:01:05

if you aot compile, you run all your namespaces while building, which can cause bugs that wouldn't happen if you didn't aot compile

alexmiller19:01:28

Many of those could be considered bugs in your code too

noisesmith19:01:13

if you change protocol definitions, aot cache can cause very weird bugs if you forget to fully clean the cache before restarting, or if you reload the new protocol but don't reload code that uses it

rcustodio19:01:04

well, i will tell them that

alexmiller19:01:57

Few responses to those in threads above. I agree with not aot ing libs but I think it’s reasonable thing to consider at app level

rcustodio20:01:36

So @alexmiller, not at libs, but at services/apps you would recommend to use it then?

alexmiller20:01:45

I recommend to consider it when deploying. You may run into some reason it doesnt work but worth trying imo

rcustodio20:01:59

I see, thanks

joshkh20:01:45

I'm playing with Ring and Sente web sockets and I have a question about sessions. In normal REST you return a response with the new session value. Sente's server socket router fn passes the session map to your defined routing multimethod, but I can't figure out how to modify the session from one of my multimethods. For example, something like this doesn't work:

(defmethod msg-handler
  :my.project/authenticate
  [{:as ev-msg :keys [event id ?data ring-req ?reply-fn send-fn]}]
  (let [{:keys [username password]} ?data
        session (:session ring-req)]
    (when-let [user (authenticate username password)]
      (do
        (when ?reply-fn (?reply-fn {:token (jwt/sign user mock-secret)
                                    :exp   (str (time/plus (time/now) (time/seconds 120)))}))
        (assoc session :anything "no bueno")))))

alex-dixon22:01:48

What JRE should I get if I want to use the latest clojure / clj command line tool?

seancorfield22:01:46

It'll will work with pretty much any JRE @alex-dixon -- what do you have installed?

alex-dixon22:01:37

Thanks. Just intended as a general question / what advice we’d give newcomers. I’m exploring options for making Clojure easier to get started with and looking for something like a sane default / community recommendation

seancorfield22:01:05

For newcomers who don't already have a JRE installed, I'd just say download the latest stable from Oracle or OpenJDK...

alex-dixon22:01:30

Ok. Thanks. I think Macs come with Java 1.6? In that case would JRE 1.8 still be recommended? Don’t know what JRE is required for Clojure 1.9 TBH…

seancorfield22:01:31

Clojure itself runs on Java 6 upward. Not all libraries support Java 6 tho'...

seancorfield22:01:09

That library runs on Java 6 to 9, as well as supporting back to Clojure 1.2.

seancorfield22:01:08

Whereas https://build.clojure.org/job/java.jdbc-test-matrix/ (the Contrib JDBC wrapper) only supports back to Clojure 1.7 (but still runs on Java 6 to 9).

seancorfield22:01:56

That's why there's no recommendations on JRE versions really...

seancorfield22:01:59

Backward compatibility is a pretty serious thing in the Clojure community. Dropping Java 6 support would be a "big deal". As each library decides to drop support for an old version of Clojure, that's also a "big deal".

seancorfield22:01:59

And I think Macs don't come with Java at all nowadays @alex-dixon -- it's installed on demand the first time you type java in a Terminal.

andy.fingerhut23:01:04

@alex-dixon I am not sure I have a Mac without a JVM already installed on which to try this, but I believe if you get a freshly installed Mac with any version of macOS from the last 3 years or so, and type any 'java ...' command in the Terminal, it will offer to install a JVM for you, and it will be Java 1.8.x for some x

andy.fingerhut23:01:07

There are a few wrinkles with Java 9 and some Clojure tooling (e.g. with not-the-most-recent versions of Leiningen), but other than that, as long as the libraries you are using are happy with the JVM version you are using, you should be good. I regularly run tests of a Clojure tool with multiple JVM versions 1.7 and later with no issues.