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

Re: Constructors



 jak:      I don't think the difference between;
         	(make-foo :name 'bar :number-of-widgits 50)
         and:
         	(make-instance 'foo :name 'bar :number-of-widgits 50)
         is sufficiently large to constitute a useful addition in
        abstraction.

pd  The difference is the same as between
    (send object :do-this ) and (do-this object).

I don't understand the analogy at all.

 
pd   You do that by adding the following option in the defclass:
     (:CONSTRUCTOR make-bar-foo (number-of-widgits &aux (name 'bar)))
    This option is textually close to the initargs declaration,
    which is another advantage over a separate constructor function.

1) How does the &aux get added to the argument list of a constructor?
How does this do what jak asked for?
2) This option is not textually close to any inherited initarg
declarations.  The fact that it is close to some and not all has large
confusion potential.
  
    On any architecture, if you implement MAKE-INSTANCE by
    interpreting the various data structures (initargs list, default
    initargs), it is going to be costly.  You will need a mechanism to
    generate some specialized code reflecting the interpretation for a
    particular class.  

This is clearly a good thing.
The question it is better to focus it on calls to make-instance, or is
it better  to combine this optimization with an automatic function
generation facility, with other features?  The former seems like the
"general mechanism" to me (pd says "I think it is better to
agree one a general mechanism.")