[CM] SDL is unchanged still but here's another for ImGui
chohag at jtan.com
chohag at jtan.com
Mon Jul 8 15:53:26 PDT 2024
Norman Gray writes:
>
> I'm fully sympathetic with the less-magic point of view. I've written a
> modest amount of CPP macro cleverness over the years, and I find my
> tolerance for CPP magic has gone _down_ rather than up over the
> years.[*]
>
> As it happens, my previous version of that scheme-macro-filter.scm
> program was also written in the service of creating an FFI for a
> library. That is, exactly the problem of writing repetitive code which
> I might want to change my mind about. I started off writing a pile of
> CPP macros, and quickly confused myself. I had at the time recently
I think we forget how powerful our tools are sometimes.
Consider the lists of constants in s7sdl.scm. Each group has a shell
command that will extract the list from the SDL headers in the event
that it changes but in fact these were worked out after I'd copied
the lists into my editor with a simple mouse motion (it fits on a
screen!) and sorted and formatted them with a few keystrokes. That
would not have been fun 25 years ago.
Similarly with a few simple commands I can turn a list of symbols
into a sequence of instructions and all their metadata quicker than
I can work out how to write a macro to get the compiler to do it.
Sometimes I feel a bit dirty but I'm usually three or four tasks ahead already.
> [*] At one point, a while ago, I participated in the maintenance of a
> library which was written in object-oriented C. This being the 90s, and
> C++ still rather unstable, the original author of the library had
> elected to implement the OO system entirely in CPP macros. This was
Wild times. But on the other hand at least we had very little JavaScript.
However on the gripping hand there was perl.
Matthew
More information about the Cmdist
mailing list