[cmucl-imp] Function with declared result type NIL returned.

Raymond Toy toy.raymond at gmail.com
Wed Jun 15 18:21:47 UTC 2016

>>>>> "Raymond" == Raymond Toy <toy.raymond at gmail.com> writes:

>>>>> "Mark" == Mark Cox <markcox80 at gmail.com> writes:
    Mark> G'day, I think there may be an issue with the way CMUCL
    Mark> handles return values.

    Mark> I'm having trouble developing a reduced test case so I have
    Mark> attached the code I encountered the issue with. The code
    Mark> relies on an external library titled external-program.

    Raymond> Thanks for the test case.  I can reproduce this on my
    Raymond> system as well.

    Raymond> Based on the error message it seems as if
    Raymond> external-program:start was declared not to return
    Raymond> actually returned.  That would seem to indicate an error
    Raymond> in external-program not cmucl.

Ok, I think it's probably caused by the defgeneric form that defines
the method:

(defgeneric start
    (program args
     input if-input-does-not-exist output if-output-exists error if-error-exists
     environment replace-environment-p
  (:method (program args &rest rest)
    (declare (ignore program args rest))
    (error "This CL implementation does not support START.")))

Because this particular method ends with a call to error, it can never
return, and thus has a return type of NIL.  (A return type of NULL
means it can return NIL.  NIL means it doesn't return.)

I think this is confusing cmucl.  Not sure how to fix this in PCL.
I also don't understand why the compilation of cmucl.lisp to add the
actual method doesn't override this declaration.

The hacky solution is to add #-cmucl for that method in the
defgeneric.  This makes things work.


More information about the cmucl-imp mailing list