libera/#commonlisp - IRC Chatlog
Search
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
12:35:25
pjb
nij-: have a look at https://github.com/informatimago/lisp/blob/master/common-lisp/cesarum/file.lisp#L248 & following.
12:35:45
pjb
nij-: what's wrong with http://groups.google.com/group/comp.lang.lisp/msg/1bab4b5bae1fdca3 http://groups.google.com/group/comp.lang.lisp/msg/190d771c0e033a1c ?
12:37:06
pjb
nij-: also, access seems to be like & and defref: http://informatimago.com/articles/usenet.html#C-like-pointers-in-Lisp
13:15:27
VincentVega
How does SBCL decide when to call a compiler macro? I am trying some examples from CLHS define-compiler-macro and the original function is called.
13:17:23
phoe
all examples up to (funcall (compiler-macro-function 'square) '(funcall #'square x) nil) work as expected
13:20:10
beach
VincentVega: As I recall, the OPTIMIZE values may determine whether the compiler macro is called.
13:22:53
phoe
VincentVega: and check the SBCL manual for optimization qualities, maybe some high DEBUG or something can cause SBCL to not use compiler macros
13:24:48
phoe
#sbcl might provide more information, or the devs could write something in the manual about how CMs are treated
13:26:37
VincentVega
phoe: thanks! I will probably ask there. http://ix.io/3M4h optimization options didn't turn out to have an effect.