chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] handle "unbound variable" exception for undefined pr


From: Shawn Rutledge
Subject: Re: [Chicken-users] handle "unbound variable" exception for undefined procedures?
Date: Mon, 5 Jan 2009 21:50:07 -0700

On 12/24/08, Kon Lovett <address@hidden> wrote:
>  Have you looked in Unit lolevel at
> 'set-invalid-procedure-call-handler!' &
> 'unbound-variable-value'? These, plus perhaps 'object-become', might be
> useful.
>
>  #;1> (use lolevel)
>  ; loading library lolevel ...
>  #;2> (unbound-variable-value 'unbound)
>  #(unbound)
>  #;3> (set-invalid-procedure-call-handler! (lambda (p as)
> (print "No Such Procedure: " p ", Called With: " as) 'bar))
>  #<procedure (##sys#invalid-procedure-call-hook .
> args1208)>
>  #;6> (x "foo")
>  No Such Procedure: unbound, Called With: (foo)
>  Warning: the following toplevel variables are referenced but unbound:
>   x
>  bar
>  #;7> (enable-warnings #f)
>  #f
>  #;8> (x "foo")
>  No Such Procedure: unbound, Called With: (foo)
>  bar

Thanks very much, I did not know about these features.

However the trouble is that the name of the unbound variable (the name
of the function that was to be called) is still lost, even though the
warning prints it out.

I don't think I'm following what you were thinking about object-become.

>  The unbound warning is a problem. I dislike turning off such a system just
> for a single annoyance.

Yes.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]