Thanks a lot!
If you’ve referenced these symbols by name in the body of the form, you already knew you needed them,
Yes, but I do not know how many of them. The purpose of this macro is to create a lexical environment to test a network code. Some functions take just one port as a parameter, but the others - two and more. With this macro it would be very easy to call these functions and to link their IO through the port numbers:
(with-free-ports 0 10
(fn-1 port-1 port-2 port-3)
(fn-2 port-1))
And with the first posted version of with-free-ports
I achieved it. The problems appeared when I tried to bind start
in run-time. From your reply and from the u/lispm comments I understood that this is not a good idea. What I do not understand, is how to use such macros inside another macros/functions, which can supply with-free-ports
with start
and end
parameters ? Also, I cannot figure out, when exactly macro-expansions take place if I use many enclosed macros. Are they expanded all at once when I compile my code?
Anyway, I am very grateful for your suggestions. This helps a lot to learn CL.
Thanks a lot to everybody!