Clojurians
#boot
<
2016-09-28
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

anmonteiro00:09:25

how should I write a task for side effects?

anmonteiro00:09:55

does

(deftask foo []
  (dosh “side” “effecting” “command"))
just work?

micha00:09:23

@anmonteiro no, tasks must return a fileset

micha00:09:27

you can do this:

anmonteiro00:09:33

so with-pass-thru maybe?

micha00:09:52

(deftask foo []
  (with-pass-thru _
    (println "hi there")))

levitanong05:09:45

It seems like requires inside pod/with-eval-in are slower than outside.

(time (require ‘some.ns)) ;; 0.1 ms
(time (require ‘some.ns :reload)) ;; 20 ms
(pod/with-eval-in some-pod
  (time (require ‘some.ns))) ;; 4500 ms
Any idea why this is so? :open_mouth:

levitanong05:09:52

@martinklepsch suggested that outside was faster because it was caching from a require further up, but as you can see, there is a :reload keyword in the second require, and while it takes a little longer than the one above it, it’s several orders of magnitude faster than inside the pod.

levitanong06:09:14

Or is (require … :reload) still faster than a fresh require?

martinklepsch11:09:31

@levitanong I think :reload does not reload all transitive dependencies of a namespace which is what a "fresh" require does

levitanong13:09:03

@martinklepsch I see… I did do a time on the top level ns, and it did take about 4s. So it does seem like :reload does something differently from a fresh require. Now my question is, what do you mean by "transitive dependencies”?

martinklepsch13:09:10

@levitanong when you require a namespace that namespace may require other namespaces these are "transitive dependencies"

martinklepsch13:09:51

I guess you could also call it indirect but transitive is often used in the context of Maven dependencies and I think it makes sense here too

levitanong13:09:57

@martinklepsch so if for example a namespace foo depends on a namespace bar, and that in turn depends on a namespace baz, a :reload on foo only refreshes foo, and won’t see any changes to baz?

martinklepsch13:09:41

I'm not 100% sure if that is true but it would explain the differences you're seeing

juhoteperi13:09:50

Yes, require :reload doesn't reload changed namespaces transtitively

juhoteperi13:09:53

there is :reload-all option which reloads all namespaces always

juhoteperi13:09:01

which can be very slow

levitanong15:09:02

Okay, it is clear to me now. Thanks, @martinklepsch and @juhoteperi! :smile:

alandipert23:09:21

@symbit are you behind a proxy/firewall? maybe you need to configure proxy settings?

alandipert23:09:35

although, it's odd it's failing for maven central but not for clojars... both are https...