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

Re: Issue: LOAD-OBJECTS (Version 2)



    Date: Fri, 13 Jan 89  18:54:18 CST
    From: David N Gray <Gray@DSG.csc.ti.com>

    This looks good.  The only thing I have doubts about is:

    >   The function MAKE-LOAD-FORM-USING-SLOTS can be useful in user-written
    >   MAKE-LOAD-FORM methods.  Its first argument is the object.  Its
    >   optional second argument is a list of the names of the slots to
    >   preserve; it defaults to all of the local slots.
    >   MAKE-LOAD-FORM-USING-SLOTS returns forms that construct an equivalent
    >   object using MAKE-INSTANCE and SETF of SLOT-VALUE for slots with
    >   values, or SLOT-MAKUNBOUND for slots without values, or using other
    >   functions of equivalent effect. 

    Rather than having the second argument default to a list of all instance
    slots, it might be better to consider two separate cases:

      1. If a second argument is supplied, then MAKE-INSTANCE will be used to
	 create the object, (using INITIALIZE-INSTANCE to default the slot
	 values), and then the designated slots will be forced to
	 have the proper value.

      2. Without a second argument, ALLOCATE-INSTANCE will be used to create
	 the object (without invoking INITIALIZE-INSTANCE or
	 SHARED-INITIALIZE), and then all the slots will be filled in.

    If you are going to specify all of the slot values, then there shouldn't
    be a need to compute default values, and it may be undesirable to invoke
    INITIALIZE-INSTANCE -- for example, it might complain about missing
    required arguments or perform undesired side-effects.

I don't think it's a good idea to have such a large deviation in behavior
based on whether an optional argument is present or not.  What if the
argument is present but its value is a list of all the slots?

I personally cannot figure out whether calling INITIALIZE-INSTANCE when
it's not wanted, or failing to call it when it is wanted, would cause
more unexpected behavior.  I have to resolve that by keeping it simple
so the programmer can figure it out on his own.  So I think it should
always create the object with MAKE-INSTANCE.

    >   The default MAKE-LOAD-FORM method for STANDARD-OBJECT signals an
    >   error.

    Wouldn't it be permissible to just not have a default method, so that a
    "no applicable method" error is signalled?

Agreed.