Fork me on GitHub

Has anything ever materialized from Rich Hickey's thoughts regarding limited support for distributed processing?


I know that at least at one time datomic used hornetq(renamed to something else a while back) internally, and I would draw a straight line from the mention of a jms and queues there in that email to that (actually I recall rich asking on irc sometime after that email if anyone was familiar with hornetq)


But nothing ever built into clojure


In com.stuartsierra.component the following extend-protocol section occurs:

(defprotocol Lifecycle
  (start [component])
  (stop [component]))

(extend-protocol Lifecycle
  #?(:clj java.lang.Object :cljs object)
  (start [this]
  (stop [this]
Given this, (satisfies? com.staurtsierra.component/Lifecycle 0) is always true. Is there any other incantation I can use to distinguish between a c.s.component and something else?


typically component and others like it are used to create an object graph at startup to run an application. or in tests or the repl to build a version of the application with certain versions of components. The usage of component is usually in one spot and there aren't a lot of code paths that really should handle components and non-components. What problem are you running into?


Using satisfies? is often a "code smell" because you're trying to use conditionals instead of polymorphism, so I'm definitely curious as to the use case here @clumsyjedi?


Really I was just thinking the component maps used in all of my apps could serve as a form of cheap documentation, I could generate directed graphs from the system object


(def edges (reduce (fn [coll [node component]]
                         (if (component? component)
                           (let [deps (->> (->map component)
                                           (filter (fn [[depk depv]]
                                                     (and (not= depk node)
                                                          (node? depk)
                                                          (component? depv))))
                                           (map key))]
                             (apply conj coll (for [dep deps] [node dep])))
                       [] SYS))


I would really like it if that filter on line 4 could exclude stuff that's not an instance of c.s.component


Not a big deal, if it can't be done I can find another way 🙂


@clumsyjedi Well, anything can be in the system map and it might implement the protocol via metadata. That's a deliberately design decision, so that start and stop are identity functions on anything that doesn't override them. Components can be functions, for example.


A hash map can be a component with no specific lifecycle too, but it can have dependencies (something like a function can implement start/`stop` but can't have dependencies).

Jakub Holý (HolyJak)14:10:18

Hi folks! Any idea where to pose questions about the clojure/ library? Namely it seems unable to produce Properties with data, which I think should be supported:

(require '[ :as j])
(j/to-java java.util.Properties {"a" "1","b" "2"})
; => {} ; = empty Properties
(Of course it fails, since Properties have not constructor taking a Map). So I guess I would like to open a PR to add a defmethod that handles the pair Properties APersistentMap . Should I? How? Thank you!

Alex Miller (Clojure team)14:10:24

you can ask questions on with category Contrib libs /

Alex Miller (Clojure team)14:10:03

jiras will be made from questions there if needed

Alex Miller (Clojure team)14:10:40

if you're interested in providing patches, that is the same contributor process as for Clojure or other contrib libs per

👍 1
🙏 1
Joshua Suskalo14:10:10

Is there a tool available at the moment like macroexpand that shows expansions of :inline? Or should I just call the inline function directly and validate the result that way?

Alex Miller (Clojure team)14:10:14

well other than the compiler of course :)

Alex Miller (Clojure team)14:10:38

the expansion is in the calling code's bytecode so that's the best place to verify such things


Is there a channel here for people running Clojure on more than one machine server side and the machines are stateful, i.e. not the 'stateless layer that converts http requests to db transactions' ?




there was but gets rebooted constantly and the state is lost :drum_with_drumsticks:

Muhammad Hamza Chippa20:10:51

I have a .sql file which contains this code            create table if not exists users (
    id integer primary key,
    first_name text not null

insert into users (first_name) values
is there any way to load .SQL file in .clj file ?


slurp if you want to get its contents as a string - just as with any other text file.

🙌 1

Also if you want to use the SQL commands as Clojure functions (rather than just keeping them as strings) you can use

🙌 1
Muhammad Hamza Chippa13:10:50

I implemented HugSql , worked lie a charm


Is there anything other than AOT compilation that might trigger protocol-not-implemented errors?

No implementation of method: :<method> of protocol: #'<protocol> found for class: <class>


weird namespace loading


which i guess basically just comes down to multiple loading


I figured it was something like that seeing as I've only ever encountered this error either because of AOT or reloading at the REPL.


But I'm not really sure how that could be happening here.


In this case I get that error even when running the repro code as a script.


The protocol is in a git dependency if that makes a difference.


and really aot and reloading end up being sort of the same root cause, in the reloading case you have the same protocol defined multiple times, in the original and the reload, in the aot case you have the same protocol defined multiple times, once in clojure code and once in jvm byte code


how is the protocol extended to the object/type?


is it a deftype/defrecord and inline, or is it via extend-type or extend-protocol?


The former.


do you mind sharing the name of the dependency if it is open source?


It's not, sadly.


Actually, wait. The protocol might be.


Darn. No. Neither are.


check to make sure the dependency is properly extending via the protocol and not via an interface


that can be tricky to determine, but the red flag is if the dependency is using import on something with the protocol's name


It's requiring the protocol, looks like.


if the protocol is coming it from a dependency of your dependency, then that transitive dependency might the source of the issue, is it a maven dep? if it isn't well packaged it might have been aot compiled


The dependency is a git dep of a private repository.


Perhaps cached files somewhere?


We tried blowing away ~/.gitlibs.


does (-> obj class supers) at the repl show a type with the same name as the protocol?


when you look at the code of your dep, are you looking at the same git sha as you are depending on?


We compared the SHAs in clojure -Stree.


If that’s what you mean.


compared to what?


I just mean that when you are reading the code of your dependency to try and figure out how it is satisfying the protocol, are sure the code you are reading is the same version as what you depend on


since it sounds like you have a relatively deep git dependency tree, I would watch out for the same git dep being pulled in with different coordinate names


which might cause you to have multiple versions of a dependency on the classpath


> compared to what? Compared them to each other. The dependency appears more than once in the tree, with :use-top next to one of them.


yeah, I am not talking about comparing the tree, it sounds like you are looking at the source of the dependency, so I am suggesting making sure the version of the source you are looking at matches the version you are using (e.g. you are not looking at master but using a version from a month ago)

Alex Miller (Clojure team)22:10:38

the key is usually that you want to ensure you load/compile the ns that defines the protocol first, before any ns'es that have protocol implementations.


This ought to happen automatically assuming that the namespaces that have protocol implementations require the namespace that defines the protocol, right?

Alex Miller (Clojure team)23:10:08

yes, the problem is with a reload later that redefines the protocol

Alex Miller (Clojure team)23:10:26

see for a lot of history and info on how this manifests

Alex Miller (Clojure team)22:10:26

if you -Spath, that should umambiguously show you which lib/sha is being used


Does anyone happen to know if all directories specified in -XX:HeapDumpPath must exist prior to the heap dump getting created?

Jakub Holý (HolyJak)09:10:53

I would ask e.g. at StackOverflow, this is more of a JVM question than Clojure so you might get better response rate there


Related: does-XX:OnOutOfMemoryError get executed before or after the -XX:+HeapDumpOnOutOfMemoryError heap dump is written?