This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-26
Channels
- # aleph (1)
- # announcements (9)
- # aws (6)
- # babashka (18)
- # babashka-sci-dev (25)
- # beginners (79)
- # calva (30)
- # cider (34)
- # clj-kondo (25)
- # cljsrn (6)
- # clojure (26)
- # clojure-australia (1)
- # clojure-europe (6)
- # clojure-norway (1)
- # clojure-poland (6)
- # clojure-uk (3)
- # clojured (2)
- # clojurescript (14)
- # datomic (19)
- # events (1)
- # google-cloud (1)
- # gratitude (2)
- # helix (1)
- # hyperfiddle (2)
- # interceptors (1)
- # jobs (17)
- # joyride (96)
- # leiningen (5)
- # lsp (20)
- # minecraft (2)
- # nbb (5)
- # other-languages (1)
- # re-frame (34)
- # releases (2)
- # shadow-cljs (15)
- # spacemacs (1)
- # xtdb (19)
Has anyone installed cljstyle from brew recently? I get the standard "we're Mac and you need to find the actual file and right click it since we don't know the developer"
Not brew but we (in our team) did not have any problem using installation script: https://github.com/greglook/cljstyle#installation-script-macos-and-linux
I want to create something like Python's __init__
files that make it easier to import stuff.
My intention is to let users just do (:use [everclear.api])
instead of (:require [everclear.parse.create-user-ns :refer [defrule]])
.
Example:
(ns everclear.api
(:require [everclear.parse.create-user-ns :refer [defrule]]))
However, if I try to do
(:require [everclear.api :refer [defrule])
I get the error message defrule
not defined.
defrule
is a macro btw. How do I allow users to import stuff from api
?I would strongly advice against doing that. See https://github.com/bbatsov/clojure-style-guide#prefer-require-over-use and https://stuartsierra.com/2016/08/27/how-to-ns.
If you want to make an API namespace that just gathers functions from other namespaces, just write wrapper functions.
I considered that at first. Wrote a wrapper macro 🙂 🙏 Thanks for steering me back on the right path.
Asking for a friend..... Is there a substantive difference between writing a wrapper function or doing something like:
(ns api
(:require [that.which.i.wrap :as to_wrap]))
(def crossed-beams? to_wrap/crossed-beams?)
I once used potemkin/import-vars
but it confused some tooling. (I think clojure.tools.namespace
that parses ns macros at the heads of files).@U03E8292BBL Tooling which relies on static analysis won't see docstrings and arglists that way
no, but it's in final stages of review
Ummm, I’m doing something wrong? Does anyone know how to construct a keyword programatically that I can call against a map. I thought it would be simple, but I’m missing something. Here’s about what I’d like. Note, I’d like the namespace (get props ::component/keyword)
Doesn’t work.
(get props (keyword (str ":component/" k))
::stuff
is a reader construct, not a runtime construct. You have to use a full namespace.
Also, don't use :
when constructing a keyword - it'll become a part of the name or namespace.
And don't use string concatenation - keyword
has another arity for specifying namespaces.
You can still use a namespace alias though, but it will be indirect:
(keyword (namespace ::component/-dummy-kw) k)
cheers for the reply. I’m following you, but I’m not sure where to find the source so I can see this multi-arrity
if you want to resolve the alias into a full ns, you can do that on the namespace mappings of course
@U036UJBDM5G (doc keyword)
This is all very interesting. Thanks for the quick response. I’ve got it from here. CHEERS
Do you know any pure Clojure generic connection pool? Or should I just look at Apache Commons Pool? (https://commons.apache.org/proper/commons-pool/)
Using Commons Pool as a bit awkward but its def a good option, if you need a very robust solution. Otherwise a record with some internal state might be a simpler option
hikaricp is quite good: https://github.com/brettwooldridge/HikariCP
Yes, I know: https://github.com/tomekw/hikari-cp 😉 I'm looking for something generic, like "any TCP connection" pool
Thx @U0JEFEZH6, dirigiste looks 👌
I'd vote against dirigiste. It may https://github.com/clj-commons/dirigiste/blob/master/src/io/aleph/dirigiste/Executor.java#L64 in some cases. There is an https://github.com/clj-commons/dirigiste/issues/12.