5 ms·
I recently built a side project that utilized core.async. My thoughts on it are that the use of go-style channels combined with immutable data structures makes
by hacker_9 9y ago
I recently built a side project that utilized core.async. My thoughts on it are that the use of go-style channels combined with immutable data structures makes for a really nice experience when reading and writing code.
My main problem was with the frustrating debugging experience: Clojure is so concise that breakpoints can be difficult to place, and macros are almost completely off limits. On top of that, figuring out which part of the code would pick up after blocking on a channel was just tiresome. These are the main reasons I decided not to continue with Clojure personally.
- jgalt212 9y ago> breakpoints can be difficult to place I can see that for sure, but don't avoid macros. In fact, I think roll your own debugging and logging are their best use cases. Great post on this here: http://eli.thegreenplace.net/2017/notes-on-debugging-clojure-code/ http://eli.thegreenplace.net/2017/notes-on-debugging-clojure...
- didibus 9y agoIt's probably not what you want to hear, but there's a "I get it" moment I reached at one point, where my intuition just all of a sudden was able to quickly pin point all my errors. There's a lot of these moments in Clojure. There's one for reading the code, one day you wake up and you don't see the parenthesis anymore. There's one for prefix notation. There's one for recursion, where you suddenly figure out how to convert any loops to it. There's one for the documentation, it goes from not making sense to perfectly explaning how each function works concisely and clearly. And there's one for error messages and debugging. There might be more. So, the community and core team is aware of the learning curve hump, and always trying to improve it, but after you get over the learning hump, the challenges of debuging almost go away, and it becomes equal to any other language. At least it did for me, and it was almost an epiphany.
- pgt 9y ago`(pst)` prints the last stack trace, which can really help with debugging. I only learned this after two years of Clojure.
- Zak 9y ago> On top of that, figuring out which part of the code would pick up after blocking on a channel was just tiresome. This can be a sign that a construct other than a channel is better suited to the problem at hand. Options include future/deref and promise/deliver.
- hcarvalhoalves 9y agoFor debugging Clojure, I use a mix of: - REPL-driven development [1] - Platform-specific debuggers [2] (e.g. IntelliJ debugger on JVM) - Logging infrastructure [1] https://vimeo.com/223309989 https://vimeo.com/223309989 [2] https://www.youtube.com/watch?v=ql77RwhcCK0 https://www.youtube.com/watch?v=ql77RwhcCK0