From: Rick
Subject: Revised webpage: Lisp Tips for people who know Java
Date: 
Message-ID: <3EC5AE5E.343CB5A6@yahoo.com>
I corrected a few gross errors and made a few additions...

(You are welcome to tear this apart.)
http://www.prism.gatech.edu/~gte185y/lisp.html
From: Kenny Tilton
Subject: Re: Revised webpage: Lisp Tips for people who know Java
Date: 
Message-ID: <3EC6443B.5060800@nyc.rr.com>
Interesting project, btw. Please let us know what feedback you get from 
Javans.

Rick wrote:
> I corrected a few gross errors and made a few additions...
> 
> (You are welcome to tear this apart.)
> http://www.prism.gatech.edu/~gte185y/lisp.html

"Constructors
If you just need to initialize arguments, use :initform. If you need to 
do more complicated object construction, you can do this:

Example constructor for the class dog:
(defmethod initialize-instance :before ((this dog) &rest initargs)
   (print "constructing dog")) "

Sorry, but this is a godawful example. :)

You advertised it as "more complicated object construction" but 
demonstrated "null object construction". It should be something that 
uses eiter/or global state or other slots to fill in another slot:

  (setf (area this) (* (width this) (height this)))

... or simply asserts some condition to make sure the programmer is 
using the class correctly:

   (assert (and (numberp (width this)) (numberp (height this))))

And in that case, you want an :after (not :before) method on i/i, so 
shared-initialize (called by the primary initialize-instance) has 
already been called to apply the initforms, default-initargs, and initargs.

btw, since this is an introductory doc, you might want to emphasize how 
much havoc can be created by leaving off the i/i qualifier (shadowing 
the primary i/i which calls shared-i) or by leaving off the specializer 
on "this", such that the method applies to all classes. (I like to do 
one or the other once every two-three months. <g>)


-- 

  kenny tilton
  clinisys, inc
  http://www.tilton-technology.com/
  ---------------------------------------------------------------
"Everything is a cell." -- Alan Kay