From 681caade84b2423e91eb623cee9f5b75480d75d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Mon, 13 Apr 2020 09:55:59 +0200 Subject: [PATCH] clos: allocate-instance: add a comment in allocate-instance As pointed out by Dr. Robert Strandth initargs argument may be passed to allocate-instance only after the class has been already finalized, and indeed we finalize it in make-instance. To be on a safe side, unlike CLASP, we still check whether the class is already finalized in case of someone calling allocate-instance outside the make-instance method. --- src/clos/standard.lsp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/clos/standard.lsp b/src/clos/standard.lsp index e63c37568..4cc5da686 100644 --- a/src/clos/standard.lsp +++ b/src/clos/standard.lsp @@ -98,8 +98,12 @@ (defmethod allocate-instance ((class class) &rest initargs) (declare (ignore initargs)) - ;; FIXME! Inefficient! We should keep a list of dependent classes. + ;; As pointed out in the CLASP source code (after Dr. Strandh), the + ;; class is already finalized, because initargs can't be computed + ;; without finalizing the class. We keep the next form to be on a + ;; safe side, but under normal circumstances it is never executed. (unless (class-finalized-p class) + ;; FIXME! Inefficient! We should keep a list of dependent classes. (finalize-inheritance class)) (let ((x (si::allocate-raw-instance nil class (class-size class)))) (si::instance-sig-set x)