In clarifying and correcting my example I found the issue. I was storing a lambda deep inside some data structure and later updating the lambda code to catch exceptions but an effectively cached lambda in my session wasn't updated to the changed one (the evils of state..). A fresh session where all code was consistent and the exception catching worked just as expected. The protos and laziness were coincidental to the cause of my confusion.
sorry for the noise. On Sunday, March 30, 2014 5:12:44 PM UTC+1, Patrik Sundberg wrote: > > doh. that's a badly translated example by me. I'll have another go at > translating the actual code that isn't completely broken like attempt 1. > > On Sunday, March 30, 2014 2:24:38 PM UTC+1, Michał Marczyk wrote: >> >> The problem is that inner-lazy is a method of AProto which is >> implemented for ARecord, but actually called (in trigger-fn) on a >> vector of two ARecords. The exception thrown is an >> IllegalArgumentException complaining about the missing method. >> >> inner-lazy2 works, because it's just a regular function. Note that it >> could call the-fn rather than the-fn2 -- the-fn is a method of AProto >> just like inner-lazy, but in this snippet it's actually called on >> ARecord instances, so the method lookup will be successful. >> >> Cheers, >> Michał >> >> >> On 30 March 2014 14:18, Patrik Sundberg <[email protected]> wrote: >> > I'm trying to work out how to catch exceptions close to source in some >> code >> > with structure similar to this: >> > https://www.refheap.com/68851 >> > >> > A doall on line 13 doesn't change the outcome. >> > >> > So not involving records and protocol a similar structure does what I >> expect >> > it to do, but with them I seem unable to catch exceptions taking place >> > inside the proto fns. >> > >> > So I realize I'm missing something around how exception handlers are >> setup >> > and triggered with regards to either lazy eval, lambdas or protocols >> (or >> > some combo therein). >> > >> > I'd like my toy example to calculate 20 as a result of calling >> (trigger-fn), >> > same as it does with (trigger-fn2). >> > >> > Any explanations of what's going here would be most welcome - I'd >> really >> > like to understand the exception handling logic. >> > >> > Thanks, >> > Patrik >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Clojure" group. >> > To post to this group, send email to [email protected] >> > Note that posts from new members are moderated - please be patient with >> your >> > first post. >> > To unsubscribe from this group, send email to >> > [email protected] >> > 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 [email protected]. >> > 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 [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
