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.

Reply via email to