Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread Timothy Baldridge
What REPL are you using? A rather nasty side-effect of NRepl is that it tends to send messages from non-main-threads to weird places. On Sun, Oct 8, 2017 at 10:29 PM, wrote: > I just re-wrote much of the code to run on the main thread. And so now I > can see the

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
I just re-wrote much of the code to run on the main thread. And so now I can see the error message (which was about a nil value in a place where I was certain there would be no nil values). Which is great. But since the app does a lot of I/O, I would like to for this app to be multi-threaded.

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
Possibly this is a complication arising from the use of Slingshot? It would take a 2 maybe hours to completely tear Slingshot out of this app, but I would do that if I thought I would then be able to see the error messages. On Sunday, October 8, 2017 at 11:46:26 PM UTC-4, tbc++ wrote: > > I

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
It's a bit absurd, but at the end of core/main I'm now catching Exceptions, Throwable and Object. But this doesn't seem to help me see what is happening on background threads. (defn -main [& args] (slingshot/try+ ;; 2017-10-04 -- see this: ;;

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
Well, the people behind Slingshot have suggested it as the Slingshot version of catch Exception, but I like your idea and I'll try it. Having said that, as I said in my last post, the only place I call (retry!) is inside the catch block, so the code does end up inside of that catch block. But

Re: any? in clojure 1.9.0 alpha

2017-10-08 Thread Timothy Dean
Thank you, Alex. I'll check them out. ~Timothy Dean On Sun, Oct 8, 2017 at 8:09 PM, Alex Miller wrote: > We had this discussion at length in several places (clojure mailing list, > clojure-dev mailing list, reddit probably) over a year ago when any? was > added in

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread Timothy Baldridge
I don't think you can catch an Object on the JVM can you? What happens if you catch Throwable? On Sun, Oct 8, 2017 at 9:43 PM, wrote: > So, for instance, this says that 10 documents were retried: > > {"message" {:num-slabs 1, :num-active-slabs 1, :enqueued 389,

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
So, for instance, this says that 10 documents were retried: {"message" {:num-slabs 1, :num-active-slabs 1, :enqueued 389, :retried 10, :completed 378, :in-progress 1}} The only place that I call retry! is in this catch block (this function runs in a background thread): (defn advance

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
Using spit to an append to a log file, I end up seeing much more than what I can see from Timbre. The app writes a few lines, then dies: ("\n\n\n\n\nResource usage: " "Memory in use (percentage/used/max-heap): (\"3%\" \"133M\" \"3568M\")\n\nCPU usage (how-many-cpu's/load-average): [4

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
More generally, I'm having trouble seeing any kind of logging messages. Even when I delete this Timbre config, and simply go with Timbre defaults, and set the level to "trace", I only erratically see anything printed to the logs. I assume there are messages dying in background threads, but I

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
(errors/log) simply writes to the Timbre logging library. I thought perhaps there was an error in my Timbre configuration, so I wrapped those functions in try/catch, but I still don't see anything. I'm trying this as my Timbre config: (defn- set-timbre-level [] (timbre/set-config!

Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread lawrence . krubner
I'm trying to use a Zach Tellman's durable-queue to pass information from one part of my app to another. I have 3 queues. I also have a function that runs every 30 seconds, that is suppose to report some statistics for me: (fn [] (future

Re: Releasing scope-capture, a library for easing REPL-based debugging

2017-10-08 Thread Jiacai Liu
Wow, what a good idea. Thanks for sharing. On Mon, Oct 9, 2017 at 7:05 AM, Mike <145...@gmail.com> wrote: > Cool! Thanks, Val! > > воскресенье, 8 октября 2017 г., 10:09:19 UTC+3 пользователь Val Waeselynck > написал: > >> Hi, I'm happy to release a tiny Clojure/Script library called >>

Re: any? in clojure 1.9.0 alpha

2017-10-08 Thread Alex Miller
We had this discussion at length in several places (clojure mailing list, clojure-dev mailing list, reddit probably) over a year ago when any? was added in 1.9.0-alpha10. Search the archives for the prior discussions, I don't have time right now to re-summarize it all. On Sunday, October 8,

Re: Releasing scope-capture, a library for easing REPL-based debugging

2017-10-08 Thread Mike
Cool! Thanks, Val! воскресенье, 8 октября 2017 г., 10:09:19 UTC+3 пользователь Val Waeselynck написал: > > Hi, I'm happy to release a tiny Clojure/Script library called > scope-capture . > > https://github.com/alvalval/scope-capture > > Loosely

Re: any? in clojure 1.9.0 alpha

2017-10-08 Thread Timothy Dean
If the ship has sailed, why, then, the ship has sailed. I only send this now because I'd already written it before I saw your reply, Alex. I do not think `any?` is a "gigantic" mistake, though I do think it is confusing. I expect to see a few some?/any? bugs from beginners. `some?` and `any?

Re: The performance of plain map vs. defrecord

2017-10-08 Thread Jiacai Liu
Ooh, thanks for your tips. On Sun, Oct 8, 2017 at 7:19 PM, dennis zhuang wrote: > First, the alphabet-macro is wrong, it should use name instead of str in > comp: > > user=> (macroexpand-1 '(alphabet-macro)) > (do (clojure.core/defrecord Alphabet [:a :b :c :d :e :f :g :h

Re: How to try/catch Let bindings?

2017-10-08 Thread Gary Verhaegen
As others have noted, this is pretty much what monads are made for. I've found Brian Marick's "Functional Programming for the Object-Oriented Programmer"'s chapter on monads really good at teaching how to recognize situations where monads would be a good fit. For this specific use-case, you can

Re: Clojure examples

2017-10-08 Thread John M. Switlik
Context: STEM with quality gets the heads out of silicon. Clojure will be the central enabler. Just like we have diversity in human affairs, so too ought computing be multi (disciplinary, hetero, …). https://www.quora.com/What-could-boost-Clojure-adoption/answer/John-M-Switlik Funny thing. I

Re: The performance of plain map vs. defrecord

2017-10-08 Thread dennis zhuang
First, the alphabet-macro is wrong, it should use name instead of str in comp: user=> (macroexpand-1 '(alphabet-macro)) (do (clojure.core/defrecord Alphabet [:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :w :v :x :y :z]) (def dummy-record (Alphabet. 0 1 2 3 4 5 6 7 8 9 10 11 12

Re: Releasing scope-capture, a library for easing REPL-based debugging

2017-10-08 Thread Paulus Esterhazy
This looks great, thanks for publishing this, Val! On Sun, Oct 8, 2017 at 9:09 AM, Val Waeselynck wrote: > Hi, I'm happy to release a tiny Clojure/Script library called scope-capture. > > https://github.com/alvalval/scope-capture > > Loosely speaking, scope-capture

The performance of plain map vs. defrecord

2017-10-08 Thread Jiacai Liu
As I read JoyOfClojure, it says one of reasons that prefer record over plain map is speed, out of curiosity I test this using https://github.com/hugoduncan/criterium, but the result is just contrary to my expectation. record is slower than map. Is there any optimizations made to clojure 1.8.0

Releasing scope-capture, a library for easing REPL-based debugging

2017-10-08 Thread Val Waeselynck
Hi, I'm happy to release a tiny Clojure/Script library called scope-capture . https://github.com/alvalval/scope-capture Loosely speaking, scope-capture makes it trivial to reproduce from the REPL the context of a piece of code after it