Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. (defmacro defclass (name superclasses slots &rest options-and-doc)
  2. ;; A lot of stuff here...
  3. ;; Non-abstract classes need a constructor.
  4. `(defun ,name (&rest slots)
  5. ,(format "Create a new object of class type `%S'." name)
  6. (declare (compiler-macro
  7. (lambda (whole)
  8. (if (not (stringp (car slots)))
  9. whole
  10. (macroexp--warn-and-return
  11. (format "Obsolete name arg %S to constructor %S"
  12. (car slots) (car whole))
  13. ;; Keep the name arg, for backward compatibility,
  14. ;; but hide it so we don't trigger indefinitely.
  15. `(,(car whole) (identity ,(car slots))
  16. ,@(cdr slots)))))))
  17. (apply #'make-instance ',name slots))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement