[Ecls-list] make-load-form fix
Julian Stecklina
der_julian at web.de
Fri May 26 08:45:03 UTC 2006
Juan Jose Garcia Ripoll <lisp at arrakis.es> writes:
> Hi Julian,
>
> the patch below should not be required. If the list contains objects
> that must be built using MAKE-LOAD-FORM then the compiler should detect
> it. Otherwise, one setf statement per array element is an overkill.
>
> Can you show me a code that breaks with the current version?
See below.
> On Fri, 2006-05-26 at 05:17 +0200, Julian Stecklina wrote:
>> RCS file: /project/ecl/cvsroot/ecl/src/clos/print.lsp,v
>> retrieving revision 1.11
>> diff -u -r1.11 print.lsp
>> --- src/clos/print.lsp 17 May 2006 15:17:29 -0000 1.11
>> +++ src/clos/print.lsp 26 May 2006 02:42:04 -0000
>> @@ -79,10 +79,11 @@
>> (array
>> (values `(make-array ',(array-dimensions object)
>> :element-type ',(array-element-type object)
>> - :adjustable ',(adjustable-array-p object)
>> - :initial-contents ',(loop for i from 0 below
>> (array-total-size object)
>> - collect (row-major-aref
>> object i)))
>> - init))
init is not declared. But you could return nil as second value. But this
has another problem, when the array in question references it self. When
you compile and load the following example, (aref *blub* 1) will be 0,
which is clearly wrong. The struct in the array is needed, because
otherwise this code path would not be executed. (On a sidenote: If you
compile this file, start a new instance of ECL and load it, it will
complain about a missing class FOO. Bug?)
;; Don't forget to set *print-circle* to T. ;)
(eval-when (load compile eval)
(defstruct foo
zop)
(defmacro bar ()
(let ((v (make-array 2)))
(setf (aref v 0) (make-foo)
(aref v 1) v)))
)
(defparameter *blub* (bar))
Regards,
--
Julian Stecklina
Being really good at C++ is like being really good at using rocks to
sharpen sticks. - Thant Tessman
More information about the ecl-devel
mailing list