This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-13
Channels
- # beginners (202)
- # boot (7)
- # cider (14)
- # clara (2)
- # cljs-dev (7)
- # clojure (56)
- # clojure-italy (9)
- # clojure-spec (6)
- # clojure-uk (12)
- # clojurescript (40)
- # core-async (3)
- # datomic (6)
- # duct (1)
- # editors (10)
- # emacs (5)
- # fulcro (24)
- # off-topic (16)
- # onyx (4)
- # pedestal (1)
- # planck (8)
- # portkey (2)
- # re-frame (31)
- # reagent (23)
- # tools-deps (8)
- # vim (3)
@arrdem I knew of Perlis's collection of epigrams before, but learned another nice one from the document you linked to: "One can't proceed from the informal to the formal by formal means." I like it. Made me go and re-read the whole list, and got a chuckle out of this one: "Purely applicative languages are poorly applicable." http://www.cs.yale.edu/homes/perlis-alan/quotes.html
having had a lot of design and coordination meetings recently⌠âIf a listener nods his head when youâre explaining your program, wake him up.â itâs funny âcos itâs true
Hmm, there are people who will slow down talking and think you're not following if you're not frantically nodding though đ
otherwise Iâm gonna develop a resting bitchy face due to thinking hard but theyâll think I donât like their idea XD who invented this human interface and when are they going to put out bug fixes?
(try
(if (< 0.5 (rand))
(throw (ex-info "OMG" {:type :ugly-error}))
(throw (ex-info "WTF" {:type :mean-error})))
(catch clojure.lang.ExceptionInfo e
(case (:type (ex-data e))
:ugly-error "Caught an ugly one!"
:mean-error "Caught a mean one!")))
My concern is that :type
and case
feel like a weaker ad-hoc replacement for actual Exception types/dispatching. OTOH creating LotsOfTypesLikeThis also feels wrong
that's exactly what throw+ does, but better https://github.com/scgilardi/slingshot
see (throw+ {:type ::bad-tree :tree tree :hint hint})
and the subsequent try+
(defn read-file [file]
(try+
[...]
(catch [:type :tensor.parse/bad-tree] {:keys [tree hint]}
(log/error "failed to parse tensor" tree "with hint" hint)
(throw+))
(catch Object _
(log/error (:throwable &throw-context) "unexpected error")
(throw+))))
also worth checking out https://github.com/cognitect-labs/anomalies and https://github.com/dawcs/anomalies-tools
slingshot + anomalies sounds like a good combination! Good to settle on a narrow set of ns-qualified keywords (using bare :type
or :foo-error
is more prone to typos)
I remember where I heard that! (anomalies) https://youtu.be/oOON--g1PyU?t=19m40s đ