libera/#commonlisp - IRC Chatlog
Search
3:07:17
beach
Yes, and specifying mainly those things that the main Common Lisp implementations agree upon anyway.
3:10:02
aeth
I think global state would be more of the domain of ASDF or whatever the build system used is
3:10:22
nij-
beach Does WSCL try to specify all unspecified details? Or does it have a taste on which one to specify and which one not to? If it's the latter case, what's the taste?
3:12:54
beach
The main preference is for behavior that the main Common Lisp implementations agree upon.
3:14:44
beach
There could be minor disagreements, like we can propose a TYPE-ERROR to be signaled, and some implementations may currently signal a SIMPLE-ERROR.
3:43:01
jhiltu
I've tried using cl a bit but I've never really understood macros, when to use them or how to write them. Now I'm attempting to play around with cl-sdl2 a bit and I wonder if I could somehow write a macro for defining keybindings like this? https://github.com/jhiltu/cl-sdl2-test-project/blob/main/keys.lisp
3:43:24
jhiltu
this is the current main (and only) file.. it's a barebones skeleton for cl-sdl2 project https://github.com/jhiltu/cl-sdl2-test-project/blob/main/test-project.lisp
3:44:57
beach
jhiltu: Macros are used to create new syntax, not at the character level (for which there are reader macros) but at the s-expression level.
3:45:30
beach
jhiltu: Creating new syntax like that might decrease the amount of boilerplate code that would otherwise be required.
4:20:01
aeth
jhiltu: Imo... The most common, simple macros that you may want to use or define probably fit the define-foo, with-foo, or do-foo patterns. In other words, define a global with certain boilerplate removed (probably a wrapper over defclass or defun... rarely perhaps something like deftype or defparameter), or define a local (quite frequently with unwind-protect), or define a custom iteration.
4:22:10
aeth
for instance, Practical Common Lisp has a do-primes as its example. https://gigamonkeys.com/book/macros-defining-your-own
8:15:16
jhiltu
I just don't understand macros :'( I tried looking at a million examples online but it never works :D https://gist.github.com/jhiltu/acd149b2f91f6bfffc17afe529702b27
8:19:18
beach
jhiltu: The arguments to a macro are not evaluated. They are forms. So when you type (DEF-KEYS-CLASS FOO MY-KEYS), then MY-KEYS is going to be passed as a symbol to the macro expander.
8:23:33
beach
Wanting to force evaluation is a sign of that. But why do you want to pass the keylist as an argument? Are you going to define more than one class with the same list of keys?
8:26:37
beach
I have no easy solution, but that's probably because I am preoccupied with other stuff. Maybe someone else can figure something out.
8:38:37
beach
Yes, indeed. If someone comes up with a reasonable solution, I think that will be the case. But I am not very concentrated right now.
9:10:49
beach
But, yes, you can force evaluation using EVAL, or in this case, you may be able to use just SYMBOL-VALUE.
9:24:53
jack_rabbit
Hello! I have a small macro here to enable continuous retrying of a form via restart. I'm curious if there's a better way to do this: https://plaster.tymoon.eu/view/4249#4249
9:39:37
younder
If there is only one parameter why use key. You could use &boy instead of &rest. Something like (defmacro with-retry (report &optional (restart-name 'retry) &body body)...
11:29:57
jack_rabbit
younder, Thanks, good idea. But other than the argument style, the implementation looks reasonable?
13:10:53
jhiltu
I ended up abandoning the whole idea of classes and macros and things I don't understand... and just used property lists in case someone's curious https://gist.github.com/jhiltu/be20d1b1f424d6e33ad9c15804d4e740