The Common Lisp Condition System by Michał “phoe” Herda

The Common Lisp Condition System by Michał “phoe” Herda

Author:Michał “phoe” Herda
Language: eng
Format: epub
ISBN: 9781484261347
Publisher: Apress


Note that our macro needed to expand into a progn in order to accommodate more than one generated form. We can see that the superclass list in defclass now contains the name of the condition class and that the :report option has been rendered into its separate print-object method . In addition, we return the name of the condition from the final form, as dictated by the Common Lisp standard.

For clarity, we will separate our macro into two logical parts. The first will be a function named define-condition-make-report-method that will be used for generating the defmethod print-object form .(defun define-condition-make-report-method (name report-option)

(let* ((condition (gensym "CONDITION"))

(stream (gensym "STREAM"))

(report (second report-option))

(report-form (if (stringp report)

`(write-string ,report ,stream)

`(funcall #',report ,condition ,stream))))

`(defmethod print-object ((,condition ,name) ,stream)

,report-form)))



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.