summaryrefslogtreecommitdiff
path: root/posts
diff options
context:
space:
mode:
Diffstat (limited to 'posts')
-rw-r--r--posts/2022-10-05-goops-issues.md12
1 files changed, 11 insertions, 1 deletions
diff --git a/posts/2022-10-05-goops-issues.md b/posts/2022-10-05-goops-issues.md
index a85c552..c9925b3 100644
--- a/posts/2022-10-05-goops-issues.md
+++ b/posts/2022-10-05-goops-issues.md
@@ -88,7 +88,7 @@ Here's what those look like in Common Lisp:
((name :initarg :name :accessor name)))
(defmethod greet ((p person))
- (format t "You: 'Hello ~a!'~&" (name p)))
+ (format t "You: 'Hello, ~a!'~&" (name p)))
(defmethod greet :before ((p person))
(format t "> You gather the courage to talk to ~a.~&" (name p)))
@@ -104,6 +104,16 @@ Here's what those look like in Common Lisp:
(greet (make-instance 'person :name "Alice"))
```
+Expected output:
+
+```
+> You take a deep breath.
+> You gather the courage to talk to Alice.
+Hello, Alice!
+> That wasn't so bad.
+> You are socially exhausted. You should rest.
+```
+
I often want to tack on some logic before or after a method, so these
qualifiers are extremely useful and they compose nicely with
inheritance because child classes that implement more specialized