Mercurial > hg > amuse
comparison 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 |
comparison
equal
deleted
inserted
replaced
1:cbb5b478307e | 2:8fbbb0f14f3c |
---|---|
1 ;; Some conditions we might want to be able to signal | |
2 | |
3 (define-condition undefined-action (condition) | |
4 ;; This condition would apply to an attempt to perform a meaningless | |
5 ;; operation on an object. This may, initially, include things that | |
6 ;; are a pain to implement but should really be used when it's | |
7 ;; genuinely unclear what an operation means in the given | |
8 ;; context. In such cases, a condition handler might be the best | |
9 ;; approach anyway. | |
10 ((operation :initarg :operation | |
11 :reader undefined-action-operation) | |
12 (datatype :initarg :datatype | |
13 :reader undefined-action-datatype)) | |
14 (:report (lambda (condition stream) | |
15 (format stream "The consequence of performing ~A on and object of type ~A is undefined" | |
16 (undefined-action-operation condition) | |
17 (undefined-action-datatype condition))) | |
18 | |
19 (define-condition insufficient-information (condition) | |
20 ;; It should be possible to construct genuinely minimal musical | |
21 ;; structures. When the information in these is insufficient to | |
22 ;; answer a query, this condition should be raised. | |
23 ((operation :initarg :operation | |
24 :reader insufficient-information-operation) | |
25 (datatype :initarg :datatype | |
26 :reader insufficient-information-datatype)) | |
27 (:report (lambda (condition stream) | |
28 (format stream "The ~A object does not contain enough information to perform ~A" | |
29 (insufficient-information-datatype condition) | |
30 (insufficient-information-operation condition))) | |
31 | |
32 |