#clojure log - Feb 23 2017

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

4:31 Rovanion: Why do we call them symbols instead of names?

4:31 dysfun: symbol is accepted terminology. also name is taken for the part that isn't the namespace

4:36 osfabibisi: is there already something like: (defn and->> [f value] (doto value f))

4:37 e.g. to run something parenthetically, returning the original value unchanged.

4:38 e.g. https://gist.github.com/HakimCassimallyBBC/10fdaec1d1907e758e92403933ada0c8

4:41 Rovanion: I tend to define a transparent print which returns the printed value in the case of println. But to answer your question: No idea.

4:42 osfabibisi: yeah, we're doing a fair bit of (defn some-side-effecting-thing [side-effect-input passthrough] (do-something-to side-effect-input) passthrough)

4:42 but you can rework that into a function that takes the passthrough and does something with it (or ignores it, doing something else ;-)

4:43 Rovanion: Oh yeah absolutely.

4:44 dysfun: osfabibisi: doto ?

4:44 ,(doto 123 prn)

4:44 clojurebot: 123\n123

4:44 osfabibisi: dysfun: yeah, essentially the function in my gist does a doto

4:45 dysfun: oh i missed that, haven't woken up properly

4:45 osfabibisi: it's just slightly wrapping it to avoid a layer or so of parentheses in the caller (and making it easier to remember which way round to put the function depending on whether you're in a -> or a ->>)

4:49 dysfun: (defmacro &-> [value & fs] `(let [v# ~value] (doto v# (some-> v# ~@fs))))

4:50 osfabibisi: what's the advantage of wrapping in a macro here?

4:50 and why some-> ?

4:50 I like the &-> name, ta

4:50 ah, you're chaining multiple functions

4:50 dysfun: well i'm expanding to some-> which is a macro, so it has to be a macro

4:51 and i choose that because i'm guessing at your desired underspecced behaviour :p

4:51 osfabibisi: hehe

4:51 I'm not certain we need that, but I'll make a note for when we do :D

4:52 dysfun: well my gut tells me you only want it for println

4:52 in which case copy `?` out of useful

4:52 osfabibisi: nope, commit'ing sync-point in kafka queues too

4:52 dysfun: oh, cool

5:14 Hanonim: do you always gpg sign your stuff when publishing to clojars ?

5:15 dysfun: clojars won't accept it if you don't

5:19 Hanonim: oh

5:19 i supposed it's best to use a key that never expire ?

5:19 dysfun: perhaps better to have proper key rotation procedures

5:20 osfabibi_: do old dists stop being installable if you change your key?

5:21 dysfun: no

5:21 * osfabibisi doesn't really get gpg... we use `pass` to share passwords, and it's an enormous pain in the arse, but I suspect it could be made nicer if someone deeply understood it

5:21 dysfun: once you have pushed them to clojars with a valid gpg signature, they are there til you delete them

5:22 i suspect it just needs a nice gui

5:22 osfabibisi: so all it proves is that someone once had a gpg-key?

5:22 well, the command-line part of `pass` is fine

5:22 dysfun: it proves that it has not been tampered with since upload

5:23 osfabibisi: it's just that everyone has to update their keys every time we get a new starter, which I suspect isn't the best way but haven't cared enough to understand how to do it better

5:23 dysfun: hah. so i have a project that solves this one

5:23 but it's not finished yet

5:24 Hanonim: what do you mean by key rotation in this context ?

5:24 if my current key expires, what happens ?

5:24 dysfun: you rotate to a new key

5:25 Hanonim: yes but is the work signed with the old key still accessible ?

5:25 dysfun: at which point you will experience nothing probably. if your org has security turned up, they'll be checking the artifact signatures and reject an unknown key

5:25 yes, it will remain accessible

5:25 the user will get a warning the key is expired

5:25 * osfabibisi still finds crypto confusing and hard

5:25 dysfun: but it's not

5:26 only writing it is hard

5:26 osfabibisi: every time our secure certs run out at work, it takes about a month to get everything working

5:26 Hanonim: so i could, let's say every year, complete delete my old key and simply gen a new one ?

5:26 dysfun: yes. many people do

5:26 osfabibisi: e.g. converting things from pem to p12 or vice-versa, figuring out how to extract them without passwords for svn etc.

5:26 dysfun: ah yes. that's all fun

5:26 at some point i should write something to de-tedium this

5:27 osfabibisi: there are a million instructions on how to openssl convert things on our internal wiki

5:27 some of which work for the particular circumstance you're trying to convert...

5:27 (of course actually *understanding* what you're doing would make it easier...)

5:27 dysfun: they need to hear about how wonderful ACME is

5:27 osfabibisi: acme?

5:27 dysfun: the protocol letsencrypt uses

5:28 your employer should install an acme server

5:28 osfabibisi: I thought that was a free https cert provider?

5:28 dysfun: they are, yes

5:28 but acme is the protocol your client speaks to the server

5:29 you just run a little command on the server and boom, new updates

5:29 restart apache, done

5:29 osfabibisi: don't you need to e.g. update httpd.conf and such?

5:29 dysfun: if the filenames are the same and the keys haven't changed types, why?

5:30 osfabibisi: ah you mean you only have to do that *once*?

5:30 dysfun: yes

5:30 great isn't it?

5:38 redpoppies: hello, everyone

5:38 dysfun: hello

5:39 redpoppies: can anyone help with converting the following to clojure? : https://gist.github.com/rredpoppy/c453400fbf4b9a15ca6fe4ad18f28f42

5:39 hello @dysfun

5:39 dysfun: you don't need to use an @ here :)

5:39 redpoppies: we meet again:)

5:39 ok

5:39 dysfun: okay, what have you written so far?

5:40 redpoppies: I am at loss about typecasting

5:40 dysfun: well for the most part you don't need to. it's all Object to clojure

5:41 redpoppies: doing (.. ^WSBindingProvider pt (setOutboundHeaders some-headres))

5:41 dysfun: you can use type hints to avoid reflection (which slows things down)

5:41 redpoppies: doesn't work, it says no such method

5:41 as the pt binding is not typecast

5:42 yeah, I am guessing the "for the most part" doesn't work

5:43 dysfun: i don't really use .. tbh

5:43 not sure i can help

5:43 redpoppies: I am not sure I get this "it's all object to Clojure" part

5:45 dysfun: there's type erasure. a lot of the checking of java is done by the java compiler. clojure either sees a primitive or Object

5:45 and java generics are a complete compiler fiction, because their contents are all Object

5:46 Para^-^: Fiction written by Martin Odersky, of all people even.

5:46 dysfun: clojure just bypasses the java compiler and generates jvm bytecode so it doesn't care

5:46 luma: well, in a perfect type system, all types could be erased at runtime...

5:46 (static type system)

5:46 dysfun: sure, if you want to lose replabiilty

5:47 that was one of the tradeoffs i didn't like about pony

5:53 redpoppies: so, any idea for my concrete example?

Logging service provided by n01se.net