This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-26
Channels
- # adventofcode (2)
- # beginners (69)
- # boot (37)
- # cider (6)
- # clara (31)
- # cljs-dev (75)
- # cljsrn (5)
- # clojure (72)
- # clojure-dev (7)
- # clojure-italy (11)
- # clojure-nl (8)
- # clojure-russia (2)
- # clojure-spec (56)
- # clojure-uk (54)
- # clojure-za (1)
- # clojurescript (156)
- # cursive (2)
- # datomic (34)
- # emacs (1)
- # fulcro (227)
- # hoplon (74)
- # jobs (1)
- # jobs-discuss (16)
- # leiningen (5)
- # lumo (17)
- # off-topic (9)
- # om (3)
- # onyx (10)
- # other-languages (1)
- # portkey (2)
- # re-frame (2)
- # reagent (36)
- # reitit (1)
- # remote-jobs (1)
- # ring-swagger (8)
- # shadow-cljs (85)
- # slack-help (2)
- # spacemacs (6)
- # specter (3)
- # sql (17)
- # test-check (15)
- # tools-deps (80)
Would love for us to swallow that frog and just settle on one format to rule them all. I'd gladly give up my personal formatting preferences in exchange for not having to care about this ever again :)
If @bozhidar and @cfleming band together and settle on a zformat formatting style, that’s a significant portion of the market
Make it opt-in and apply on save
We’re considering introducing Clojure to an existing team – not having to argue about formatting would be huge — zprint looks fantastic, with native-image support so could even be run on a github pre-commit hook.
I think people quite quickly get the whole paredit/parinfer concept, where the editor prevents you from creating an improperly delimited program … it doesn't seem a fair stretch to also prevent you from ever creating an improperly indented program
I’m definitely all for structured editing; a classic example of a really good one was Diva Scheme for PLT Scheme (now Racket): https://www.youtube.com/watch?v=GnQV4je9wTQ You need a mode to disable them temporarily though e.g. when resolving a merge.
I'm trying out parinfer and am irritated that I seem able to hit "tab" and move blocks of code around to create valid but aesthetically awful code (probably some config thing I borked). I'd love for it to be impossible to write untidy code, like making it physically impossible to create:
dangling paren:
(comment
(some-stuff "test")
)
or have two newlines between def:
(def this "thing")
(def other "thing")
… etcOTOH, I tried Parinfer via Nightcode — I knew how to write Clojure code in spacemacs via Cider, which doesn’t try to do too much — but parinfer messed me up quite a lot — it tried to be helpful but got in my way.
It helps a beginner to be able to balance forms manually, esp. if you have a linter that will point out possible problems, and a formatter that would take stylistic decisions away from you. Parinfer might be useful once you make relatively few mistakes when coding Clojure.
Parinfer is a little more loose, I agree. I think we could go a step further and have editors that totally precluded interim mistakes at all. Like: trying to add a third argument to a 2-arity function. Why do we let you type that in? Why do we let you type in something that is highly likely knowable at the reader level to be invalid, such as transposing the arguments to map – i.e. putting something that doesn't support IFn as the first argument?
There’s an interesting talk in this area at Strange Loop this year. https://thestrangeloop.com/2018/hazel-a-live-functional-programming-environment-with-typed-holes.html
I realize the dynamic nature makes some things hard to guarantee, but even though I'd say I'm a journeyman Clojure programmer, I would still appreciate the help. It's like type checking but while you type, not when you compile.
The UX for that is extremely hard to get right though — when I type a character, I expect it to show up in my buffer. If the editor puts a squiggly line later, then I know something’s wrong and I can learn something from it.
It need not be "can't type the key" levels of strictness, more like how we flag unbalanced parens today … "this is for sure going to barf". Ideally unbalanced parens become physically impossible, while messing up arguments graduates to being detected in the editor buffer rather than runtime or at compilation
I think we also have opportunity (I realize this is drifting off tools.deps but ya'll are an erudite bunch) for hinting, for instance, when I type (let [[foo bar] some-thing] …)
I occasionally pass in something non-seqable as some-thing
and invariably it takes me a few minutes to reverse engineer the cryptic error message and wth I did to cause it. Just flagging in the editor "reminder: some-thing now has to be seqable!" could be quite interesting …
@hagmonk This is what you’re looking for: https://www.facebook.com/notes/kent-beck/prune-a-code-editor-that-is-not-a-text-editor/1012061842160013
having trouble figuring out what the correct coordinate would be to use a local jar (datomic-pro), anyone doing this?
that's what I've tried. doesn't work for me. I have:
:deps {
com.datomic/datomic.api {:local/root "/home/matt/datomic-pro/datomic-pro-0.9.5697/datomic-pro-0.9.5697.jar"}
}
https://clojure.org/guides/deps_and_cli#local_jar nope, I remembered correctly
clj
Clojure 1.9.0
user=> (require '[datomic.api])
ClassNotFoundException org.fressian.handlers.IWriteHandlerLookup java.net.URLClassLoader.findClass (URLClassLoader.java:381)
user=>
installed locally via bin/maven-install
in the datomic-pro distro (same path as the jar in the deps I listed above)
datomic pro has a pom.xml with a bunch of deps in it. can't just use that jar, need all the deps in "./lib" from the distro too.
The latest tools.deps should actually read the pom inside the jar and load those for you
Make sure you are on latest clj tool
Is there any reason to prefer to doing that than using bin/maven-install
and using the mvn/version
w/datomic-pro?
you can do either. you can also use the clj support to load the pro jar from your authenticated s3 datomic repo
You should be able to set :local/root
to the dir with the pom.xml in, but not certain.
nearly, fails with some dep. Not a problem tho, can just use :mvn/version
of the local install
Quick question.. does tools.deps expose a function to add to classpath? I couldn't find anything from the documents but I would also like to avoid adding pomegranate or lucidity.package..
Still experimental
@alexmiller I was going to start thinking about add-lib in the context of find-deps. I could have users do this: (-> "clojure cache" find-deps.core/deps clojure.tools.deps.alpha.repl/add-lib)
or I could provide a fn inside find-deps.core that invokes add-lib for you. right now I'd have to depend on your add-lib branch, so I was hesitant to bake that in quite yet
yeah, I wouldn’t do that yet
cool, I might limit integration to some notes in the readme for the time being. I can't wait until we have a workflow where I can seamlessly add deps without restarting anything :)
note that the tools.deps add-lib is a little different than the other existing things out there
it’s not just blindly adding a lib (and/or it’s transitive deps), it’s actually detecting which things you don’t already have, resolving lib versions, and updating an internal map of loaded libs and versions
that too, all the standard tools.deps differences
Alembic also does the detection of existing things you have installed, although it doesn’t use a map, it uses the list of things in your existing classloader.
The tools.deps impl falls back to that
I have some crazy ideas in this space - I feel like we can go a lot further than just adding the libs. For find-deps I want to analyze clj code on github to build "recommended deps" based on the one you're importing. For instance, reagent and re-frame often go together. Intelligently figuring out exclusions could be another one.
How would I do a local build and deploy of tools.deps.alpha?
mvn clean install
Debugging some issues using tools.deps.alpha on Windows, and pretty much a noob with aether. Why would clojure.tools.deps.alpha.util.maven/make-system
return nil?
Dunno, not sure why windows would be special
I’ve got ports of clj using tdeps on Windows that work
Hmmm, that's what I would have guessed. It's being called by lein-tools-deps, so maybe the problem originates farther up the call stack.
@dave.dixon Perhaps because lein-tools-deps
calls (clojure-env)
in t.d.a.
and that shells out to call clojure
to get the list of deps.edn
files to consume -- and I would expect that command to fail on Windows (until we have a Windows port of the clj
/`clojure` shell scripts).
(so maybe it doesn't have the environment that make-system
requires)
@seancorfield That I have working, albeit locally hacked. I'll double-check that the right info is getting scraped.
Ah, OK. Cool.
I nearly said "...unless you have a mocked up version of clojure
on Windows!" 🙂