This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-07
Channels
- # bangalore-clj (3)
- # beginners (103)
- # boot (13)
- # cider (16)
- # cljs-dev (192)
- # cljsrn (44)
- # clojure (147)
- # clojure-dev (1)
- # clojure-italy (79)
- # clojure-norway (1)
- # clojure-russia (9)
- # clojure-spec (4)
- # clojure-uk (34)
- # clojurescript (65)
- # core-async (1)
- # core-logic (2)
- # core-typed (5)
- # cursive (1)
- # datascript (9)
- # datomic (26)
- # emacs (8)
- # garden (1)
- # hoplon (11)
- # humor (1)
- # jobs (1)
- # jobs-discuss (8)
- # jobs-rus (3)
- # leiningen (1)
- # luminus (1)
- # lumo (1)
- # mount (6)
- # off-topic (16)
- # om (10)
- # om-next (1)
- # onyx (10)
- # parinfer (10)
- # pedestal (25)
- # re-frame (27)
- # reagent (3)
- # rum (47)
- # uncomplicate (1)
- # unrepl (34)
- # untangled (120)
- # vim (58)
Is there a known issue between com.datomic/clj-client, figwheel, and clojure-1.9.0 ? I cannot get them to compile together. Trying to start a repl gives a spec error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at clojure.main.<clinit>(main.java:20)
Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/refer-clojure did not conform to spec:
In: [2 1] val: :as fails at: [:args :exclude :op :quoted-spec :spec] predicate: #{:exclude}
In: [2 1] val: :as fails at: [:args :only :op :quoted-spec :spec] predicate: #{:only}
In: [2 1] val: :as fails at: [:args :rename :op :quoted-spec :spec] predicate: #{:rename}
In: [2] val: (quote :as) fails at: [:args :exclude :op :spec] predicate: #{:exclude}
In: [2] val: (quote :as) fails at: [:args :only :op :spec] predicate: #{:only}
In: [2] val: (quote :as) fails at: [:args :rename :op :spec] predicate: #{:rename}
:clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__1200 0x43f50bfe "clojure.spec.alpha$regex_spec_impl$reify__1200@43f50bfe"]
:clojure.spec.alpha/value ((quote :exclude) (quote [reduce transduce into merge map take partition partition-by bounded-count]) (quote :as) (quote core))
:clojure.spec.alpha/args ((quote :exclude) (quote [reduce transduce into merge map take partition partition-by bounded-count]) (quote :as) (quote core))
{:clojure.spec.alpha/problems ({:path [:args :exclude :op :spec], :pred #{:exclude}, :val (quote :as), :via [], :in [2]} {:path [:args :exclude :op :quoted-spec :spec], :pred #{:exclude}, :val :as, :via [], :in [2 1]} {:path [:args :only :op :spec], :pred #{:only}, :val (quote :as), :via [], :in [2]} {:path [:args :only :op :quoted-spec :spec], :pred #{:only}, :val :as, :via [], :in [2 1]} {:path [:args :rename :op :spec], :pred #{:rename}, :val (quote :as), :via [], :in [2]} {:path [:args :rename :op :quoted-spec :spec], :pred #{:rename}, :val :as, :via [], :in [2 1]}), :clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__1200 0x43f50bfe "clojure.spec.alpha$regex_spec_impl$reify__1200@43f50bfe"], :clojure.spec.alpha/value ((quote :exclude) (quote [reduce transduce into merge map take partition partition-by bounded-count]) (quote :as) (quote core)), :clojure.spec.alpha/args ((quote :exclude) (quote [reduce transduce into merge map take partition partition-by bounded-count]) (quote :as) (quote core))}, compiling:(clojure/core/async.clj:9:1)
The stack trace lists a few references to figwheel_sidecar, otherwise it's all clojure.lang and clojure.core.
If I switch to clojure 1.8.0 or remove com.datomic/clj-client, then everything compiles fine. But that combination of clj-client and clojure 1.9.0 keeps throwing this error. Any ideas what might be causing it?1.9 enforces things that are silently accepted by older versions
are you using the newest figwheel?
I think so, 0.5.11
It's listed as the newest on clojars
there's a snapshot figwheel that eliminates the issue
Nope. Still get the error. It does seem to be the same error though.
It really seems weird that adding datomic/clj-client introduces the error (and removing it resolves it), but the stack trace mentions figwheel.
It does work with clojure-1.9.0-alpha15 though, but not alpha16 or 17
I suppose for the moment that's my workaround, to use alpha15 instead.
Bah, I spoke too soon. datomic/clj wasn't included. Still doesn't work with the client library at all. I guess I'll have to give up trying out spec altogether for now.
@tjscollins according to that issue " you can upgrade figwheel to 0.5.10-SNAPSHOT or greater. "
Yeah, I was using 0.5.11. Tried the snapshot too. They both don't work.
They work if I'm not trying to use datomic
And if datomic/clj-client is causing the problem, add an exclusion on org.clojure/core.async on that dependency
Adding the exclusion seems to work.
I'm surprised there isn't a more recent datomic/clj-client with an up-to-date core.async dependency that works cleanly on Clojure 1.9 Alpha 17.
FWIW, we have Clojure 1.9 Alpha 17 in production -- spec is awesome!
Yeah, it looks really neat. I'm looking forward to trying it. Thanks for the help.
@sgerguri Take the 7th row in a two-dimensional vector, drop the 10 first items in that row.
@a13 A superior editor, I know. Iāll sit down and learn it when I become a real developer.
Cursive and Emacs are roughly at the same level of approachability for me. Iāll pick a proper editor to learn when The Guild of Real Developers write my name into their books.
I briefly used Atom and Proto repl. Went back to Sublime when I couldnāt figure out a way to automatically clean up indentations/spaces in a document in Atom.
Cursive is nice, the only thing is I don't like to use multiple editors, and since Clojure isn't the only language I use, Emacs is my editor of choice š Also, Emacs is written in lisp, so it's pretty simple to hack it yourself.
Thatās the thing, because Cursive is just a plugin for IntelliJ IDEA you install that plus whatever other plugins you need and you have a single environment for everything.
After years of Vimming this plus IdeaVim just works for me, and I donāt have to learn a whole new operating system to write text files. š
Of course, tongue half in cheek. Everyone use what they are comfortable with, but unless someone is strongly entrenched in the Emacs ecosystem I think he/she would be better off just using Cursive. Plus it earns @cfleming some dough for the great effort he put in when said person then proceeds to write Clojure commercially and decides to stick with Cursive (and hence will need a commercial license)!
Is anyone still using Light Table? I'm unsure of it's current status. I've tried emacs a few times but didn't put as much effort into it than when I learned vim a few years ago. Light Table + vim mode works well for me...
@arnaud_bos afaik, LightTable is abandoned. But that might be incorrect.
Vim & Clojure work well together. Whole community of us in #vim-fireplace, I've written some blogs which I'm happy to share if you're interested.
https://github.com/LightTable/LightTable/commit/5db6b70f8a4fec3e4806d9d062d95d15fc7a4b36
> Light Table + vim mode works well for me... JFYI spacemacs uses evil-mode (vim emulation layer) by default
At first I though I'd just "learn emacs" and then move to spacemacs, but the more I procrastinate the more I think I'll just go straight into spacemacs soon.
@arnaud_bos have you tried atom + proto-repl?
I've used Cursive for a while, but I don't know why it just doesn't work for me. Also the instalRepl thingy is a killer feature for me.
I must admit I haven't try atom + proto-repl, days only have 24 hrs š
but moving from 0.8.1 is taking a while but .. http://lighttable.com/blog/
I've read that, that's why I said I was "unsure".
Does Atom+proto repl have an interactive debugger like cider?
I'm curious about private functions and data in Clojure. As my application has grown, there are now some fairly large (to me at least) maps that hold app state. So I have functions to handle a lot of the manipulation of that state. It seems rather unnatural for me to these large state objects in the global space so I've made them private. However every time I make something private in Clojure I feel like I'm kinda going against the grain.
any thoughts on app design and when to it makes sense to shed some of the old OOP style organization and when to keep some of those features in Clojure?
@dealy I personally find that having private functions and data is not something that is worth doing, see http://steve-yegge.blogspot.de/2010/07/wikileaks-to-leak-5000-open-source-java.html for a (probably mildly satirical š ) overview
If it's large maps that you're struggling with, it's usually more helpful to split their handling in a clean way, e.g. with something like cursors in particular or having your functions only operate on well defined subtrees in general
well that's only part of the problem. I'm actually more interested in design philiosophy when it comes to ensuring that data is consistently maintained. Spec will help a lot with this however its isn't production ready so I'm not using it. If someone updates app state and fubars an inner struct by removing a necessary key word, or accidentlally replaces a map with a vector, this is all possible when the app-state is available to anyone. THose kinds of concerns have always guided my design choices and its kinda hard to shake those concerns, know what I mena?
Sure, and I do agree that it's a problem, but making functions private doesn't prevent them from breaking something in your state š
I'm using clojure.tools.namespace.repl to reload my code and reset my system, however it seems to be caching old code. If I change a testing println, it continues to print the old string. Even in Cursive's debugger, I'll be ontop of the line to print one thing, and it will print the old thing. Any ideas?
@ghopper What is your setup? Do you use defonce
, component, anything like that? Or is this just with plain ol' functions?
Are you using boot or leiningen?
Nope, no defonce
s or anything.
Actually just tried https://github.com/weavejester/reloaded.repl and the same thing happens.
@dominicm Just adding a println into one of my system constructors, and it seems to hold onto the old function.
Just ftr, records hold onto the old behaviour for stop
, but the subsequent start should work.
Hmm, good to know.
I think I've gotten it to work.
Instead of passing a function into reloaded.repl/set-init!
, I passed an anonymous function, and that causes it to update.
Kinda strange, but oh well.
The function was originally in a (ns user) with a (disable-reload!) maybe/
It was in the same namespace.
Yeah, seems to work for the deeper more confusing methods now too. That was confusing.
I'm wondering if you had a missing (:require)
, that would cause the refresh to not fully work I think
No, I don't think so. I'd tried with an alias to my system namespace and fully qualified.
Oh well, I'm not too worried about it now. I'm sure I was doing something that's mentioned in the readme.
Thanks š
@dealy we've got large state maps client-side in our re-frame app - we've been using prismatic schema to ensure that state is updated consistently during development, though since schema doesn't do efficient delta checks we don't do it in production
@dealy quite a few people use spec in production. Most of what's "not finished" in spec is around feature requests, not so much in api changes or bugs.
@mccraigmccraig yea, I'm aware of prismatic schema also. I was kinda more interested in having a discussion about why building apps this way (everything open vs certain things being walled off and only accessible via well defined interfaces).
One of the reasons IMO is code bloat, writing all those interfaces will result in simple changes to the data model requiring devs to add new "add-person", "add-contact", etc. interfaces.
Sure but there's a fair amount of people using 1.9 in production as well š
Clojure is very good about adding new features that don't interfere with previous code. So it's very rare that upgrading to a new "alpha" of clojure will break existing code.
maybe I'm just too old school ( or just old! ) I've never used alpha/beta versions of languages in prod
The other problem you'll hit is that Clojure doesn't put any real meaning to the words alpha and beta. Core.async, core.match, etc. have all been in alpha for quite some time, and yet they're used in production a lot and relatively bug-free.
But about global state, we should talk about it in this way, with a global atom for your app state you have one place to look for the state of your app. You can "go back in time" simply by replacing the state with a previous state (global undo)
Debugging is simply a matter of grabbing the state and then using Clojure's normal functions to poke around.
a global persistent state, solid consistency checking and a principled model for managing updates beats fragments of state in lots of places, variable consistency management and ad-hoc updates every time for me
Yeah, it all depends on what sort of state we're discussing
also - global app state as the output of a reduce over an immutable stream of events is a model with a bunch of really nice properties, and is easy to pull of with clojure, with help of tech like datomic and/or kafka
for example: ābug just happened, dump the last N events into transit data so I can replay them in a unit test reproducing the bugā
that saves days of debugging in a microservices type app
or evenā¦ ābug happened last week, dump the N events preceding the bugā etc. - so much nicer than reading log files for 3 servers in parallel
@noisesmith do you have good articles/examples of this other than datomic?
hmaurer: This one talks about some of the same ideas: https://circleci.com/blog/why-we-use-om-and-why-were-excited-for-om-next/
@U056QFNM5 thank you!
@hmaurer I have an open source lib thatās still young, working on moving more of my production proprietary appās logic into the open source libā¦ but it really can just be done as a reduce that calls resset! on an atom, where the input sequence is a lazy infinite sequence of kafka messages (or even rabbitmq or whatever if you want to do your own persisting)
the thing is that the approach is natural enough for clojure that you hardly need a framework
@noisesmith what is the open source lib?
itās very young, but itās ludic (named because the initial metaphor was a game of chess by mail) https://github.com/noisesmith/ludic
also useful for dumping and replaying data even outside such a context https://github.com/noisesmith/poirot
it seems to me that a lot of the headaches with event sourcing come when you try to have a distributed, async system
if you do it right (with deterministic processing) you can replicate state - the trick is that every ādecisionā needs to be reified as an event sent to the rest of the system
this is the part that ludic is going to flesh out more in the future (still closed source stuff now sadly)
yes - like I mentioned, this closed source app, which is my day job and a production app
and I mean really every db from postgres to cassandra to mongo is using event sourcing internally
yes, I use kafka, since it simplifies the persist / replay part (and guarantees ordering which is a huge benefit)
Do you use Kafka as your primary datastore (e.g. with infinite retention period)? Or do you store your data elsewhere and only have a retention period of X weeks on kafka?
right, just pointing out for the postgres etc. devs event sourcing is a first class part of their architecture š
for client data we use postgres and mongo - kafka is for system state / messaging
if every server needs to agree about the state of FOO - FOO is managed by events on kafka
Iām also working on a scheme to migrate events off the kafka log into s3, and off of s3 back into the app (via an adaptor compatible with our kafka inputā¦) - but thatās in design stage still
message (I donāt like the implication of ābrokerā - for example with a proper broker you canāt do rewind/replay and these are trivial with kafka)
where some messages are explicitly stored because they are relevant to some bug or question etc.
I have a multimethods question. Suppose I am dispatching on the class of two arguments so my dispatch-fn looks like (fn [x y] [(class x) (class y)])
I can create a method matching against [class-a class-b]. Suppose for a given class-c occuring in the second position I don't care what was in the first position. I want to match on something like [_ class-c]. Is this possible? Otherwise I need to write a number of methods, one for each [class-a class-c] [class-b class-c] I'm not actually working with classes.
michaellindon: Iād suggest using the dispatch function you have and just changing the dispatch value to
[Object ClassC]
Remember dispatch values use isa?
and work across each argument in a vector form. multimethod hierarchies are underused IMHO.
i agree, i think this is what i was looking for, thank you
@michaellindon why not
(fn [x y]
(let [y-class (class y)]
(if (contains? magic-classes y-class)
[:magic y-class]
[:mundane (class x) y-class]))
I think this could work, thanks
Hello, is there some library to do http requests using kerberos auth in clojure? We have a couple of servers setup with kerberos SSO (i.e. I do kinit on my notebook and then browser connects without further manual authentication) and I need to execute http requests to these servers from my clojure code. I have found some java examples, but they seem very, very painful 8(
@bbktsk if the Java examples work, I would start w/ it, and just wrap the mess / state management behind a clj fn (instead of rewriting). do you have links for the examples?
@hcarvalhoaves Well, thatās my plan (b). I was hoping thereās already some nice clojure library to do thatā¦
these kinds of libraries (just wrappers around Java) seem to be rare. I suspect it's because either it would be 1) too thin 2) it's easy enough to roll your own
@bbktsk here are some examples of Java interop that can be useful -> https://github.com/life0fun/clojure-idiom/blob/master/java-proxy.clj
proxy
in particular is ā¤ļø ... it's easier to program Java in Clojure than in Java IMO
The original example on http://clojuredocs.org works well, but it is using a map as an input parameter. https://clojuredocs.org/clojure.core/defmulti Is it possible to dispatch according to a simple string input valueās value?
Me too. Happens when commenting on a snippet/image/video, since I think those are considered comments instead of threaded messages. š