Re: Function with declared result type NIL returned.
Raymond Toy <[email protected]> Wed, 15 Jun 2016 11:21:47 -0700
| Newsgroups | gmane.lisp.cmucl.devel |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "Raymond" == Raymond Toy <[email protected]> writes: >>>>> "Mark" == Mark Cox <[email protected]> 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 &key input if-input-does-not-exist output if-output-exists error if-error-exists environment replace-environment-p status-hook) ... (: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. -- Ray _______________________________________________ cmucl-imp mailing list [email protected] https://lists.zs64.net/mailman/listinfo/cmucl-imp