[gambit-list] What is `rte` in some exception functions?

Marc Feeley feeley at iro.umontreal.ca
Fri Sep 23 09:46:36 EDT 2016


That function extracts the runtime environment from an unbound-global exception object which is raised by eval when an unbound global variable is accessed.  The rte is the runtime environment at the point where the access occured.  It is useful to get debugging information about the context of an error.  Here’s an example of how this can be used:

(define (f x)
  (+ x (* foo 2)))

(with-exception-catcher
 (lambda (e)
   (let* ((variable (unbound-global-exception-variable e))
          (code (unbound-global-exception-code e))
          (rte (unbound-global-exception-rte e))
          (container (##extract-container code rte)))
     (pp (list 'unbound-global
               variable
               'in
               container))))
 (lambda ()
   (f 10)))

;; prints:
;;
;; (unbound-global foo in #<procedure #2 f>)

Marc

> On Sep 23, 2016, at 2:33 AM, Vijay Mathew <vijay.the.lisper at gmail.com> wrote:
> 
> What does `unbound-global-exception-rte` return? This seems to be undocumented.
> 
> Thanks,
> 
> --Vijay
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list