Ticket #613 (closed enhancement: fixed)

Opened 8 years ago

Last modified 17 months ago

(defun nil ()) crashes CCL

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


(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 8 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
? (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 8 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.

comment:3 Changed 17 months ago by rme

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

(In [16649]) Make defun complain if the user attempts to use NIL as a function name. Closes ticket:613, ticket:1101. (And see ticket:1125 too.)

Note: See TracTickets for help on using tickets.