Show step-by-step breakdown of Objective-Lisp chains

This commit is contained in:
~keith 2021-11-15 17:26:08 +00:00
parent 99b959a2d5
commit 36eeb6769c

View file

@ -55,11 +55,17 @@ Under the hood, this just passes `object` as the first argument to `method`, so
you can do stuff like this (I won't kinkshame you, but your coworkers might): you can do stuff like this (I won't kinkshame you, but your coworkers might):
```common-lisp ```common-lisp
[object slot-name (.setf value)] [object slot-name (.setf value)]
;; => [(slot-value object 'slot-name) (.setf value)]
;; => (setf (slot-value object 'slot-name) value)
``` ```
And, of course, you can chain multiple slot accesses and method calls together: And, of course, you can chain multiple slot accesses and method calls together:
``` common-lisp ``` common-lisp
[object child (.method-of-child) (.method-of-return-value) slot-of-return-value] [object child (.method-of-child) (.method-of-return-value) slot-of-return-value]
;; => [(slot-value object 'child) (.method-of-child) ...]
;; => [(method-of-child (slot-value object 'child)) (.method-of-return-value) ...]
;; => [(method-of-return-value (method-of-child ...)) slot-of-return-value]
;; => (slot-value (method-of-return-value ...) 'slot-of-return-value)
``` ```
## License ## License