freenode/#lisp - IRC Chatlog
Search
17:48:57
mseddon
hmm, how can I add a new, completely empty dispatching macro character according to the ANSI spec from a virgin lisp world? It seems to me that I'd have to first (set-syntax-from-char #\# #\PlaceholderCharacter), and then remove all the dispatch macro characters that are default, but that is silly.
18:01:55
aeth
pve: one refactoring pitfall is that you could be calling a stale version of a function after you rename it because the old function object at the old name will still exist, even if you rename and start redefining parts of the new one. So you could accidentally have two bugs (mistaken refactoring of the function that doesn't preserve behavior that isn't detected yet, and calling the old function that still behaves the old way until you rest
18:03:18
aeth
pve: e.g. (defun foobar (x) (1+ x)) then rename it to (defun foo (x) (+ 2 x)) but if you forget to change the caller, you (1) won't get any errors until you restart since the old #'foobar still exists and (2) won't notice that you're adding two instead of 1 in your refactor until you fix this first problem
18:03:46
aeth
(obviously, with such a trivial example, it's clear FOOBAR and FOO do different things)
18:06:51
aeth
You can hopefully catch this if you restart your Lisp (e.g. for slime M-x slime-restart-inferior-lisp) and quickload with :verbose t (which unfortunately is quite verbose) to see errors/warnings/etc. (I think calling an undefined function is a warning in SBCL, but it might be a style warning.)
18:09:19
aeth
I personally do (ql:quickload :uiop) (ql:quickload :foo :verbose t) because UIOP is very noisy in SBCL because quickloading it redefines every single function (to upgrade from the built-in UIOP to the latest)
18:21:14
jackdaniel
not the best solution, because 1. foo could have been inlined, 2. further redefinitions will require "remembering" the old name to change a definition
18:22:01
jackdaniel
so maybe (setf (fdefinition 'foo) (lambda (&rest args) (warn "foo called") (apply #'foobar args)))
18:22:41
aeth
yes, but quickloading with :verbose t will warn you when foo is called at quickload time, if the implementation warns on undefined functions
18:38:18
pve
aeth: I've been hit by that so many times I now run my tests in a loop in a shell in a fresh image
18:47:00
pve
although the project I'm thinking of refactoring is decently sized so I'm not sure how well the "clean compile + test" loop would work in practice