cmacro
cmacro copied to clipboard
Macros that write macros
I'd like to create some templates similar to c++
template mover <T N> {
T[N] pos;
T[N] vel;
}
I don't know how I would write a macro for this, that replaces T and N in the body. But the I'd need to create a macro that writes a macro like the first one in following example
macro mover {
case {
match {
< $(type) $(length) >
}
template {
{
$(type) [$(length)] pos;
$(type) [$(length)] vel;
}
}
}
}
struct mover <int 2> x;
This will cmc to following c-code
struct {
int [2] pos;
int [2] vel;
} x;
Another problem is, that macros written by macros don't get expanded by cmc, I have to run cmc multiple times.
I think what's missing is an 'escape' operator. It would be nice to have.
This is an 8-year-old unmaintained project.
I haven’t done anything on this project but apparently subscribed to these messages. So please take this as a humble opinion and i wish one day i would have the motive to work on this project. So my thoughts is, since this is Common Lisp, if something was working last decade, it should work the next decade too ;) Thus even if this project is unmaintained, it’s good to put ideas about improvement. We don’t know maybe someone will want to add the requested feature :)