(let [a (do-a ...) b (do-b . a . .) c (do-c . a . b)] (log/info "Success" {:a a :b b :c c}) c)
(try (let [a (do-a ...) b (do-b . a . .) c (do-c . a . b)] (log/info "Success" {:a a :b b :c c}) c) (catch Exception e (log/error "Failed" {:a a :b b :c c}) (throw e)))
Object a;
Object b;
Object c;
try {
a = doA(..);
b = doB(.., a, .., .., ..);
c = doC(.., .., a, .., b, ..);
} catch {
// The catch is in scope of a,b,c.
}
On Sep 30, 2017, at 3:14 PM, Didier <did...@gmail.com> wrote:Is there another way to execute a set of complex steps which does not rely on let and can be try/catched in the manner I describe?
I can't emphasize enough the utility of the interceptor chain pattern, as employed heavily in pedestal.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.
On Oct 1, 2017, at 9:21 PM, Didier <did...@gmail.com> wrote:I can't emphasize enough the utility of the interceptor chain pattern, as employed heavily in pedestal.Interesting... Its almost like a workflow framework, but for simpler in code workflows. I'm reluctant to have a dependency on pedestal just for this though.
I'm curious how others handle this use case, which I feel should be pretty common.Given you have a series of business process steps, where the flow is too complex for the arrow macros, and you also like to name the step results descriptively, so you use let:
(let [a (do-a ...)b (do-b . a . .)c (do-c . a . b)]
True, but as far as I know, in Common Lisp, the condition handler is always in scope of where the error happened, so I wouldn't face this problem.
I also struggle to split this up into functions without making it even more complicated. I'm intrigued by the interceptor pattern mentioned, I'll have to try it out, I worry its overkill, but not sure.
My opposition to turning this into a chain, is that it complects the order of things, with the work of each step. My steps are pure functions, they take inputs and return outputs. They don't know anything about the full workflow, just their transformation. My orchestrating function is the one which knows how to compose the smaller pure steps, so that it can fulfill the business process.
The interceptor chain seems to still complect this a little. At least it has the steps know about each other since it relies on a common context, and expects previous steps to properly assoc the data needed by later steps.
> Even in an impure language such as Common Lisp we frown on such LET formsTrue, but as far as I know, in Common Lisp, the condition handler is always in scope of where the error happened, so I wouldn't face this problem.
I also struggle to split this up into functions without making it even more complicated. I'm intrigued by the interceptor pattern mentioned, I'll have to try it out, I worry its overkill, but not sure.
My opposition to turning this into a chain, is that it complects the order of things, with the work of each step. My steps are pure functions, they take inputs and return outputs. They don't know anything about the full workflow, just their transformation. My orchestrating function is the one which knows how to compose the smaller pure steps, so that it can fulfill the business process.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.