Fork me on GitHub
#off-topic
<
2018-05-13
>
andy.fingerhut06:05:30

@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

😂 4
3Jane09:05:51

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

wink09:05:36

Hmm, there are people who will slow down talking and think you're not following if you're not frantically nodding though 😛

3Jane09:05:42

’s why I nod

3Jane10:05:24

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?

vemv18:05:35

Would this be considered an idiomatic usage of ex-info?

vemv18:05:40

(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!")))

vemv18:05:19

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

joelsanchez18:05:09

that's exactly what throw+ does, but better https://github.com/scgilardi/slingshot

vemv19:05:19

Good call! That seems to kill a good chunk of my concerns, thanks

joelsanchez18:05:55

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+))))

vemv19:05:23

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)

4
joelsanchez20:05:10

I remember where I heard that! (anomalies) https://youtu.be/oOON--g1PyU?t=19m40s 🙂

sundarj22:05:20

ooh, i haven't seen this, it looks good! thanks for sharing.

👍 4