[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some invariants
- To: Bobrow.pa@Xerox.COM
- Subject: Re: Some invariants
- From: Masinter.pa@Xerox.COM
- Date: 7 Jan 87 17:28 PST
- Cc: Common-Lisp-Object-System@SAIL.STANFORD.EDU
- In-reply-to: Danny Bobrow <Bobrow.pa>'s message of 5 Jan 87 11:29 PST
I like
(not (eq (make-instance x) (make-instance x)))
I believe that "make-" in general is expected to create a non-EQ
instance of a new object. The example you give (of looking up a name or
ID and either retrieving the old one or creating a new one should be
given a different name.
This is clearly a matter of preference (i.e., we don't have to restrict
make-instance for Classes to hang together), but the document we write
can and should impose stylistic conventions for what makes sense if the
user specializes built-in classes.
That make-instance always creates new structure is a very useful
property; for example, it means that
(let ((x (make-instance 'foo)))
(setf (foo-slot x) 3)
x)
has no global side effects.