libera/#commonlisp - IRC Chatlog
Search
0:49:52
nij-
Hello! Is it possible to define setf-expander that does file reading and writing on the file?: https://bpa.st/LMUA
1:54:42
nij-
I might try another way. Instead of defsetf, is there a way to monitor the value cell of a symbol, so that whenever the value cell is changed, we invoke a certain function?
1:58:52
Catie
You could define a :before method on the (setf ...) function, but that only handles the case where it's mutated via setf
2:00:09
moon-child
(define-symbol-macro x '(get-x)) (let (x) (defun (get-x) x) (defun (setf get-x) (nx) (notify-about nx)))
2:09:19
nij-
moon-child: Oh I see I think you mean: (let (x) (defun get-x () x) (defun (setf get-x) (nx) (setf x nx)))
2:11:08
moon-child
tired, and I was thinking about wrapping the parentheses around (setf get-x), my fingers got ahead of me
9:35:35
nij-
Those who have used accesses - while it is great to access a place given by a variable, it doesn't seem to be working for a general place form like this
9:36:51
nij-
If I want to extend the behavior, I need to hack the function accesses to expand the inner forms, right? Is it possible in principle?
9:43:59
nij-
Ok.. without stupid mistake (hopefully), here's a case that's expected to work but not:
9:56:52
phoe
first, (setf (access:accesses (nth 0 *X*) '(:a :type :plist)) nil) because it is 1 at the moment
9:57:10
phoe
then, (setf (access:accesses (nth 0 *X*) '(:a :type :plist) '(:b :type :plist)) 10) to push into the new plist
9:59:49
phoe
either that, or implement type errors in access itself - it should tell you that it cannot treat 1 as a plist