This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-10
Channels
- # announcements (2)
- # babashka (15)
- # beginners (174)
- # calva (16)
- # chlorine-clover (10)
- # clara (7)
- # clj-kondo (27)
- # cljdoc (10)
- # clojars (4)
- # clojure (50)
- # clojure-europe (10)
- # clojure-gamedev (3)
- # clojure-greece (1)
- # clojure-italy (4)
- # clojure-losangeles (1)
- # clojure-nl (16)
- # clojure-sg (1)
- # clojure-spec (7)
- # clojure-uk (41)
- # clojurescript (22)
- # data-science (15)
- # datascript (38)
- # datomic (2)
- # duct (15)
- # emacs (2)
- # fulcro (110)
- # funcool (9)
- # graphql (10)
- # jackdaw (8)
- # jobs (23)
- # joker (1)
- # leiningen (15)
- # luminus (1)
- # malli (20)
- # off-topic (26)
- # pathom (5)
- # pedestal (1)
- # reitit (19)
- # shadow-cljs (78)
- # spacemacs (2)
- # sql (52)
- # tools-deps (99)
- # vim (13)
Quick question: Any compelling reason to drop lein
in favor of deps
?
Here is a recent web forum discussion on that topic: https://clojureverse.org/t/is-there-a-sales-pitch-for-switching-to-deps-edn-from-lein-in-2020/5367/51
I think the short answer is: If Lein is doing what you need it to, then maybe check out discussions like that one to see what the differences are, and see if anything interests you in investigating deps.edn further. If you don't see anything enticing, why switch?
Thanks, I’ll check it out!
I'd respond here but I've already responded at length in that ClojureVerse post 🙂
Nice observations about :pedantic?
mode. I'm bit of a fan of :pedantic?
however that might be Stockholm syndrome :)
OTOH I'm not entirely sure if I'd like defaulting to recent versions in practice. I'd rather default to nothing if the algo has to decide anything at all that implies risks
When I used Leiningen, I also relied heavily on :pedantic?
mode and I used :exclusions
to sort everything out. Since I switched to CLI/`deps.edn`, I've never needed :exclusions
since I know t.d.a. will use the version I specify explicitly, or it'll pick the latest version that anything requests. Simple. Predictable.
Picking latest may be straightforward and predictable but I (genuinely) wonder about its simplicity
(I'm not anti deps
or anything)
From Miller's talks I vaguely recall that some dependency chains can be so intrincate that there's no perfect, automatable answer for "how to resolve?"
e.g. latest
may be deterministic but what if the result breaks your code in practice? (not unheard of)
Sure, and that happens with almost any project that pulls in the Jackson Java libs -- until you figure out the magic version of Jackson that doesn't break the oldest code that needs it and still works with the most recent code that needs it 🙂
For a while clj-new
had to have dependencies on Jackons directly, pinned to 2.7.5, to avoid conflicts with some old Leiningen templates.
Yeah I see thanks! i.e. latest
may not be perfect but at least could kill the easiest 80% right
in my personal feelings lein
do too much, developers made from it multi tool which shouldn’t be. They wrote extra plugins to compile third party code in other languages in project and do other weird things which should be done in CICD instead. project.clj
is so often unnecessary complex, because developers can do things, so they do.
deps.edn
let me easy point to clojars / m2 / git repository / local directory when I develop modules. It is clean solution which do only what should do: compile clj(s) / REPL / and a few things around.
“less is more”
But this is my opinion
i think there was a recent discussion about this on #leiningen -- starting around here: https://clojurians-log.clojureverse.org/leiningen/2020-01-30 extending on to the next day. iirc, the answer was that there wasn't currently.
Can't you specify <localRepository>
in your ~/.m2/settings.xml
file to override the default location? And you can use a system property to override that on a per-invocation basis?
I haven't tried it but...
Hmm, I guess not. I thought lein
's Maven/Aether stuff would respect that 😞
A question about software architecture with Clojure: I’m always struggling to think about the best way to organize a new Clojure project. I want to create a new project that gonna have a login (user/pass, social login, etc) and two or three features so I can test it. What is the best way to organize it? I was looking into hexagonal architecture and Stuart Sierra’s Component framework but I’d like to see a practical example so I could understand it better. This project would start as a monolithic. How could I organize it so it’d be ease to split into other services in the future?
I hint an integration between business-facing architecture and Component here https://clojurians.slack.com/archives/C03RZGPG3/p1581267577090400?thread_ts=1581261170.086600&cid=C03RZGPG3 As for implementation details (how to make the monolith enjoyable but also splittable) you may find inspiration from Sierra himself: https://clubhouse.io/blog/monolith-meet-mono-repo/
Taka a look on https://github.com/weavejester/integrant instead of Sierra component
architecture is not constant, you can start from something and later split this into a few services
there is really no answer, start to experience this yourself. Do not by afraid about experimenting and changing architecture. Do not overcomplicate simple things and always care about simplicity and readability. In the past I was doing experiments like write some app and add some new crazy business conditions like “hide all id for users, use uuid instead” etc. So architecture has to be elastic for changes. After all I think the best way is too keep everything as simple and readable as you can for needs which you have NOW. Everything has cost. If you want to have great architecture which let you use whatever DB you want or any during testings you have to add complexity. So do this when you need this instead of before.
I see. I’m always thinking the best way to organize the project so when I have to change it I don’t have to make to much changes
And with Clojure it appear to be more difficult (for me, I’m used with Java patterns)
Thanks @kwladyka. I’ll take a look into Integrant
and try to keep simple for now
Has anyone put together a Heroku buildback for using the clj
command line tool rather than Leiningen?
Yep. I started with https://github.com/heroku/heroku-buildpack-clojure and removed everything Lein-related. Ended up with something that's just about 10% in size of what it was. But it also has some app-specific things that I didn't really want to extract, so cannot really share it.
Apart from Lein, there's also some junk that won't be needed - some Ruby code, Node.js detection, maybe something else. The point is, it's pretty easy to delete all this and end up with a proper clj buildpack.
Cool. Thanks. You described my plan B and it’s nice to know the process yields something that works. I’m not sure what I’m ultimately going to be doing for the front end, so I’ll probably keep the Node.js crap in there.
There's a separate Node.js buildpack. And that's what should be used. I don't really remember why the Node.js stuff was in the Clojure buildpack to begin with. Maybe some JS code was in there, or some Lein plugin.
Ah, nice to know. It’s been over five years since I thought deeply about Heroku buildpacks.
Tempted to forbid laziness (in a very specific context of course, for a good reason):
(when (-> v class #{LazySeq})
(assert false "Parallel processing shouldn't return lazy computations"))
Any other class I should add to #{clojure.lang.LazySeq}
?there are many other seqs that are lazy, that are not LazySeq
all seqs are potentially lazy
a non-exhaustive list off the top of my head: Range, LongRange, Cycle, Iterate, Repeat, IteratorSeq, Cons,
the important thing is that list is open-ended
generically, that assertion seems incorrect to me - parallel processing often returns lazy results (pmap is one example)
A simpler approach (vs. my initial blacklisting idea) might be asserting that v
is a vector?
if it's sequential?
. That way I don't bake clj internals in my code.
---
pmap is lazy so it makes sense that f
s passed to it can return lazy results
my parallel processing thing is eager, so having lazy results means that I can be doing almost no work in parallel, and the real work in a later computation that forces the lazy computations
seq?
is another useful one.