libera/#commonlisp - IRC Chatlog
Search
23:42:04
yitzi
attila_lendvai: wscl is aimed at specifying the unspecified aspects of CL, not changing the behavior or adding extensions.
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.