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

Issue COMPILER-DIAGNOSTICS, v8



> (3) Require COMPILE-FILE to establish a condition handler.  Add a 
>     :HANDLER keyword argument to COMPILE-FILE, which is a user condition
>     handler function which is to be used during compilation.  If the user
>     handler is not supplied or declines to handle a condition, then the
>     compiler's default handler will be invoked.  Require the compiler
>     to handle the ABORT restart by aborting the smallest feasible part
>     of the compilation.
>
> ...
>
> (5) Clarify that COMPILE does not establish a condition handler.  Instead,
>     it uses whatever condition handler has been established in the
>     environment from which it is called.

COMPILE-FILE and COMPILE should be allowed to establish whatever handlers they
want, with the requirement that they be written in a particular fashion.  This
eliminates the need for a funky :handler argument which needs to handle all
condition types (possibly by just returning from the handler, thereby "refusing
to handle") because there isn't a place to associate a type with the handler.
The way you do this is to require that the compiler's handlers first resignal
the condition.  Only if nobody outside handles the condition does the
compiler's handler really do anything.  For example

    (let ((error-count 0))
      (handler-bind ((error
		      #'(lambda (condition)
			  ;; keep track of how many errors we've had
			  (incf error-count)
			  ;; allow caller to handle
			  (signal condition)
			  ;; caller passed.  print a message and abort some
			  ;; part of the compilation.
			  (format *error-output* "~&*ERROR: ~A" condition)
			  (abort))))
	...))

Using this scheme, the caller of COMPILE or COMPILE-FILE can set up whatever
handler environment he wants, with the expectation that the compiler will give
his handlers first crack at any conditions that are signaled.

For Current Practice, this is how IIM handles errors and such during
compilation (except that the restart we are currently using is not abort, but I
now think that may have been a mistake, and could easily be changed).

kab
-------