annotate conditions.lisp @ 2:8fbbb0f14f3c

Factor out conditions from classes.lisp into a new file: conditions.lisp. darcs-hash:20061016160736-aa3d6-2ad7d468ec2a423825440a6f69cc3e80a4e543fb.gz
author m.pearce <m.pearce@gold.ac.uk>
date Mon, 16 Oct 2006 17:07:36 +0100
parents
children e854a73b0328
rev   line source
m@2 1 ;; Some conditions we might want to be able to signal
m@2 2
m@2 3 (define-condition undefined-action (condition)
m@2 4 ;; This condition would apply to an attempt to perform a meaningless
m@2 5 ;; operation on an object. This may, initially, include things that
m@2 6 ;; are a pain to implement but should really be used when it's
m@2 7 ;; genuinely unclear what an operation means in the given
m@2 8 ;; context. In such cases, a condition handler might be the best
m@2 9 ;; approach anyway.
m@2 10 ((operation :initarg :operation
m@2 11 :reader undefined-action-operation)
m@2 12 (datatype :initarg :datatype
m@2 13 :reader undefined-action-datatype))
m@2 14 (:report (lambda (condition stream)
m@2 15 (format stream "The consequence of performing ~A on and object of type ~A is undefined"
m@2 16 (undefined-action-operation condition)
m@2 17 (undefined-action-datatype condition)))
m@2 18
m@2 19 (define-condition insufficient-information (condition)
m@2 20 ;; It should be possible to construct genuinely minimal musical
m@2 21 ;; structures. When the information in these is insufficient to
m@2 22 ;; answer a query, this condition should be raised.
m@2 23 ((operation :initarg :operation
m@2 24 :reader insufficient-information-operation)
m@2 25 (datatype :initarg :datatype
m@2 26 :reader insufficient-information-datatype))
m@2 27 (:report (lambda (condition stream)
m@2 28 (format stream "The ~A object does not contain enough information to perform ~A"
m@2 29 (insufficient-information-datatype condition)
m@2 30 (insufficient-information-operation condition)))
m@2 31
m@2 32