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

procedure vs special form

This page is part of the web mail archives of SRFI 23 from before July 7th, 2015. The new archives for SRFI 23 contain all messages, not just those from before July 7th, 2015.



The current proposal specifies that "error" is a procedure.  It could
instead specify that it is a special form.  The main advantage of a
special form is that it is possible to report the precise location
information (file, line, etc) in addition to the error message.
If "error" is a procedure, it is much harder to do so, in particular
when "error" is tail-called as in:

(define (f x)
  (if (< x 0)
      (error "x is negative")
      (+ 1 (sqrt x))))

The continuation that "error" will receive does not point back to "f",
so I don't see how "error" could easily report that the error occurred
in "f".

Marc