|
|
|
|
|
by sczi
295 days ago
|
|
Oooh now that is interesting. What I by mean stuff I don't even know that I don't know :) Yes mine doesn't handle that, it is the same as jupyter there. Smalltalk is supposed to be best at interactive development, I wonder if it will update the old closures. I don't know it to try, but I do know Common Lisp which is also supposed to be quite good, and fwiw it behaves the same, new closures have the new code, but the old ones are not updated: (use-package :serapeum)
(defun adder (x)
(flet ((inner (y) (/ x y)))
#'inner))
(defparameter *adders* (dict))
(defun add (x y)
(ensure (@ *adders* x) (adder x))
(funcall (@ *adders* x) y))
(add 3 6) ; => 1/2
(add 3 9) ; => 1/3
;; change / to + in inner
(add 4 9) ; => 13
(add 3 10) ; => 3/10
|
|
Here's another fun complication: what if I have a decorator that performs a code transform on the source code of the decorated function? If the code is changed, I would like to automatically re-run the transform on the new code. I made a (kind of awkward) protocol for this: https://github.com/breuleux/jurigged?tab=readme-ov-file#cust.... It's a little confusing even for me, so I should probably review it.