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


    Date: Wed, 21 Jun 89 22:06:02 PDT
    From: David Alpern <Alpern@IBM.COM>

    (defun make-foo (&rest plist)
      (apply #'pcl::*make-instance 'foo plist))

    I would have though that would be what defconstruct would be great at,
    but I can't figure out how to set it up so that the &rest arg (plist
    above) is treated as a list of initialization arguments rather than
    as just a single item.  To do this above, I needed to use apply --
    but what can one do with defconstructor?

It is best to go ahead and define such functions as you have done above
with DEFUN and APPLY.  As you point out, DEFCONSTRUCTOR doesn't have a
syntax for doing just this.

DEFCONSTRUCTOR itself is going to go away soon anyways.  It was just a
stop-gap measure until I was ready to ask implementors to provide the
right compiler hook so that I could optimize calls to make-instance more
directly.  The bulk of the DEFCONSTRUCTOR smarts will stick around its
just that there won't be an explicit interface that people have to use
to get that optimization.  

So, where you now write:

  (defconstructor make-foo foo (x) :x x)

and PCL turns it into something like:

  (defun make-foo (x) (funcall <something-hairy> x))

In the future you will write:

  (defun make-foo (x) (make-instance 'foo :x x))

and PCL will turn it into:

  (defun make-foo (x) (funcall <something-hairy> x))