From 8803fe841fa182c751b44fb0a12e4c8308d15b8f Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 5 Oct 2022 12:16:53 -0400 Subject: Show expected output of a snippet in latest post. --- posts/2022-10-05-goops-issues.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'posts/2022-10-05-goops-issues.md') 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 -- cgit v1.2.3