[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

optimization versus constructors



    Date: 15 May 87 11:07 PDT
    From: Gregor.pa@Xerox.COM

    Danny and I have been thinking about initialization and are picking away
    at parts of the problem we don't understand.  Specifically, I was trying
    to remember what the :constructor option was really for.
    ....
    This shows that whatever optimization can be gotten from the
    :constructor option can also be gotten from calls to make-instance (at
    least the calls to make-instance for which you could have used a
    constructor).

I agree that the :constructor mechanism could be replaced by a complicated
mechanism involving compile time optimizations of recognized patterns of
constant arguments to make-instance, with some way to get around the fact
that constructors can initialize any slot but we don't want make-instance
to be able to do that.  There is some trickiness required to make this
compile-time optimized code get recompiled whenever the class's structure
is changed.

I don't remember who put constructors in, but I assume the idea was that
the other way of doing it was too complicated.  It's probably a good model
for thinking about the semantics and making sure that constructors and
make-instance behave consistently, but we probably don't want to require
implementations to work that way.