Ticket #613 (new enhancement)

Opened 5 years ago

Last modified 5 years ago

(defun nil ()) crashes CCL

Reported by: stassats Owned by: gb
Priority: minor Milestone:
Component: Compiler Version: trunk
Keywords: Cc:

Description

(defun nil ()) expands to

(ccl::%defun (ccl::nfunction nil (lambda nil (block nil))) 'nil)

And call to

(ccl::dbg (ccl::nfunction nil (lambda ())))

from %defun brings CCL to the kernel debugger.

Change History

comment:1 Changed 5 years ago by gb

  • Type changed from defect to enhancement

Um, if I'm parsing your second point correctly: yes, calls to CCL::DBG land in the kernel debugger. That's what they do.

The consequences of [re]defining NIL (or any other CL package symbol) as a function are undefined.

? (defun nil () )
Lisp Breakpoint
? for help
[53348] Clozure CL kernel debugger: x
NIL
? (fboundp 'nil)
#<Anonymous Function #x30200121848F>
? 

I honestly don't know if that works (to whatever extent it does) on all platforms, and I wouldn't be too upset if it didn't.

Having DEFUN check for this and err at macroexpand time wouldn't cost much, and if anyone ever does this again I suppose that the gain from doing that check would be non-zero. (Perhaps just barely non-zero, but non-zero.)

Trapping into the kernel debugger in this case does have an attractive deterrent effect (though I think that it's mostly intended to catch malformed functions when bootstrapping a new target.)

comment:2 Changed 5 years ago by stassats

Oh, i see now that this is a continuable error. I know that this is undefined, but crashing into the low-level debugger seemed to me undesired.

Note: See TracTickets for help on using tickets.