Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro defclass (name superclasses slots &rest options-and-doc)
- ;; A lot of stuff here...
- ;; Non-abstract classes need a constructor.
- `(defun ,name (&rest slots)
- ,(format "Create a new object of class type `%S'." name)
- (declare (compiler-macro
- (lambda (whole)
- (if (not (stringp (car slots)))
- whole
- (macroexp--warn-and-return
- (format "Obsolete name arg %S to constructor %S"
- (car slots) (car whole))
- ;; Keep the name arg, for backward compatibility,
- ;; but hide it so we don't trigger indefinitely.
- `(,(car whole) (identity ,(car slots))
- ,@(cdr slots)))))))
- (apply #'make-instance ',name slots))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement