[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Constructors
- To: Common-Lisp-Object-System@SAIL.STANFORD.EDU
- Subject: Re: Constructors
- From: Patrick H Dussud <DUSSUD@Jenner.csc.ti.com>
- Date: Mon, 12 Oct 87 14:09:38 CDT
- In-reply-to: Msg of Wed, 30 Sep 87 12:37 EDT from "David A. Moon"<Moon@scrc-stony-brook.arpa>
- In-reply-to: Msg of Sat, 3 Oct 87 12:59 PDT from Gregor.pa@XEROX.COM
- In-reply-to: Msg of Sat, 3 Oct 87 13:26 PDT from Gregor.pa@XEROX.COM
[From Gregor]
I am still opposed to adding constructors to CLOS. I do believe that
they will make life a little more convenient for some programmers, but I
don't think those advantages outweigh the conceptual problems I outline
above nor do I think they are worth the added complexity of having to
describe and understand how they work and documenting the mechanism
which is used to compile them and cause them to get recompiled when
appropriate.
I don't believe that the programmer's interface (:CONSTRUCTOR option) is
complicated, the rules are like DEFSTRUCT ones.
The meta level is where all the conceptual complexity goes. But
power and reusability are more important than simplicity at this level.
Some people may object about the added code size, but any non trivial
implementation will have to optimize instance creation one way or
another.
As for the discussion about having to edit the constructor option when
the classes are redefined because some initargs would have been changed,
I think that goes in favor of the constructor options, the definition of
the interface is lexically close to where the default initargs are. If
you have a defun form for the constructor, you will have to edit the
defclass form (to edit the default initargs) and the defun form.
I don't think that we should say that constructors are going to be
faster than make-instance but the truth is that they are likely to be on
lots of implementations.
In conclusion since I don't think the option is hard to understand or to
explain and since any serious implementation will have to do something
like that (at the sub-meta level at least), I think it is a good thing
to standardize.
Patrick.