1
votes

I want to create a macro (or function) which will contain package-prefixed symbols. This is possible only if those packages have already been defined. Why? As long as i have defined the packages by the time the macro/function gets called, why is there a problem if they are undefined when the macro/function is defined?

The reason I want this is that i want to have convenience functions in my init file for starting-stopping stuff i develop in different projects-packages but I dont want to load all the projects just to be able to define the convenience functions, since i only develop one project at a time.

2
Maybe you should give an example what you want to do and we can tell you how to solve it. A symbol needs to be in a defined package or in no package. There are some advanced options what one could do, but it makes only sense to tell you about it, when we know your use case. - Rainer Joswig
I added in the question the reason why i need this. - Paralife
Now here is a case where I think the accepted answer should be shared evenly between Xach and Rainer. Xach answered to the first half, which was the whole question inittially, then Rainer helped me find a solution to the source of the problem. So, I am tossing a coin :P - Paralife
As if Rainer needs the points! - Xach

2 Answers

7
votes

The source code is read by the Lisp reader before evaluation (see read). The reader can't intern the symbols if the packages aren't already defined.

3
votes
(funcall (find-symbol "RENDER-SUPER-FANCY-GRAPHICS"
                      "THIS-PACKAGE-DOES-NOT-YET-EXIST")
         *standard-output* :width 1000 :height 800)