Closed vi1 closed 6 years ago
To clarify what I'm proposing. Have some hooks in sdl, like sdl2-whatever-hook and user can use it in his own config, like #+swank (setf sdl2-whatever-hook 'whatever).
I'm not sure this is possible for the restart code. Probably easier and arguably "desirable anyway" is just to signal in all cases, but use swank's stuff when available. I'll have to look into it.
Oh yeah, dynamic bindings.
Some like this should work:
(defun dyn-bindings ()
(let ((res nil)
(swank (find-package :swank))
(slynk (find-package :slynk)))
(when swank
(let ((sym (find-symbol "*SLDB-QUIT-RESTART*" swank)))
(when sym
(push sym res))))
(when slynk
(let ((sym (find-symbol "*SLY-DB-QUIT-RESTART*" slynk)))
(when sym
(push sym res))))
res))
(defun sdl-main-thread ()
(progv (dyn-bindings) '(continue continue)
(let ((*main-thread* (bt:current-thread))
...
progv allows symbols and values lists to be of different sizes, so ex (progv () '(continue contrinue) ...) is fine
No longer depends on swank or slynk.
Not really a bug, but can cause surprises as it did for me.
If you, say quickload sdl2 from emacs or vim in my case with swank loaded, then sdl2 will be compiled with #+swank code:
(defun sdl-main-thread () (let ((main-thread (bt:current-thread))
+swank (swank:sldb-quit-restart 'continue)
If you are later compile in sdl2 for use in standalone program it signals that no such symbol or something. It could be resolved by adding asdf dependence on swank, but it is obviously stupid. I guess such kind of conditionalizing should be done on user side somehow and not in the sdl2 itself.