This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-13
Channels
- # aleph (8)
- # announcements (3)
- # beginners (36)
- # calva (1)
- # cider (1)
- # circleci (3)
- # clj-kondo (9)
- # cljdoc (58)
- # clojars (7)
- # clojure (70)
- # clojure-europe (13)
- # clojure-japan (1)
- # clojure-nl (8)
- # clojure-russia (2)
- # clojure-uk (7)
- # clojuredesign-podcast (4)
- # clojurescript (67)
- # clojureverse-ops (14)
- # cursive (6)
- # data-science (1)
- # datahike (3)
- # datomic (6)
- # docker (1)
- # events (2)
- # figwheel-main (9)
- # fulcro (4)
- # graalvm (33)
- # graphql (8)
- # helix (1)
- # jobs (1)
- # leiningen (3)
- # lsp (39)
- # malli (9)
- # minecraft (31)
- # nextjournal (7)
- # off-topic (6)
- # portal (22)
- # re-frame (5)
- # reitit (5)
- # remote-jobs (1)
- # shadow-cljs (55)
- # sql (22)
- # tools-build (3)
- # tools-deps (4)
- # xtdb (6)
Has anything ever materialized from Rich Hickey's thoughts regarding limited support for distributed processing? https://groups.google.com/g/clojure/c/OJJL2xq2PGA/m/ASHcRWyGekoJ
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)
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]
this)
(stop [this]
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])))
coll))
[] 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).
Hi folks! Any idea where to pose questions about the clojure/java.data library? Namely it seems unable to produce Properties with data, which I think should be supported:
(require '[clojure.java.data :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!you can ask questions on https://ask.clojure.org with category Contrib libs / java.data
jiras will be made from questions there if needed
if you're interested in providing patches, that is the same contributor process as for Clojure or other contrib libs per https://clojure.org/dev/dev#_becoming_a_contributor
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?
well other than the compiler of course :)
the expansion is in the calling code's bytecode so that's the best place to verify such things
thanks
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' ?
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
('Jerry'),
('Jenny'),
('George'),
('Johanna'),
('John'),
('Anne');
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.
Also if you want to use the SQL commands as Clojure functions (rather than just keeping them as strings) you can use https://www.hugsql.org/.
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>
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.
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
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
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
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?
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
> 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)
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?
yes, the problem is with a reload later that redefines the protocol
see https://clojure.atlassian.net/browse/CLJ-1544 for a lot of history and info on how this manifests
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?
I would ask e.g. at StackOverflow, this is more of a JVM question than Clojure so you might get better response rate there