informaticsEn 2022-07-19 11:24:12
426

Introduction Common Lisp Object System (CLOS)

The fundamental elements of CLOS programs (classes, slot definitions, generic functions, methods, specializers and method combinations) are represented by first-class objects. The behavior of CLOS is provided by these objects, or, more precisely, by methods specialized to the classes of these objects.1

1 https://clos-mop.hexstreamsoft.com/concepts/#introduction


;; Classes, defined with defclass.

(defclass my-class ()
  ())

;; Instances of classes, created with make-instance.

(make-instance 'my-class)


;;; Methods, defined with defmethod.

(defmethod wizard ((object-of my-class))
  ...)

;;; Method roles

(defmethod wizard :before (...)

  ...)

(defmethod wizard :after (...)

  ...)

(defmethod wizard :around (...)

  ...)



You can get the example:

https://gist.github.com/juan-reynoso/c033276c58ddfc52cdaac92a7498efce

#lisp #clos #oop


Back to index

También te podría interesar
informaticsEn 2022-07-13 10:20:31
informaticsEn 2022-08-03 17:52:38
In this post we are going to view an Object-Oriented programming example within Python
informaticsEn 2022-08-01 14:11:38
informaticsEn 2022-07-19 11:25:47
informaticsEn 2022-07-19 11:25:00