Opened 10 years ago

Closed 10 years ago

#702 closed defect (invalid)

IGNORE-ERRORS doesn't work for macros

Reported by: ysv_ Owned by:
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: macro condition Cc:


Consider the following example:

(defmacro mdiv0 () (/ 1 0)) (ignore-errors (mdiv0))

After executing the above line CCL invoke debugger with "DIVISION-BY-ZERO detected

[Condition of type DIVISION-BY-ZERO]"

If I replace defmacro with defun the result is as expected - two values - nil and divizion-by-zero condition are returned.

Change History (1)

comment:1 Changed 10 years ago by gb

  • Resolution set to invalid
  • Status changed from new to closed

You've defined a macro that - at macroexpand time - generates a DIVISION-BY-ZERO error. A CL compiler performs what the spec calls "minimal compilation" (at least) at compile-time. Minimal compilation involves macroexpansion, so the DIVISION-BY-ZERO is happening at compile-time (before the IGNORE-ERRORS can have any effect.)

An interpreter might or might not perform "minimal compilation". If it doesn't, then macroexpansion and execution might be interleaved in some way and your example might behave as you expect it to. You can't count on that behavior: an implementation might compile everything, or offer an interpreter that does minimal compilation, and in either of those cases an error may occur before the results of macroexpansion are executed.

Note: See TracTickets for help on using tickets.