summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2022-10-05 12:16:53 -0400
committerDavid Thompson <dthompson2@worcester.edu>2022-10-05 12:16:53 -0400
commit8803fe841fa182c751b44fb0a12e4c8308d15b8f (patch)
tree0a4b8e3add4b21adfe44a8f0fa7e276d391a73be
parent930535874caa168e9654521e8c7d77e89d0ee64e (diff)
Show expected output of a snippet in latest post.
-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