开发者

Lisp: Problem with package prefix in macro/function definitions

开发者 https://www.devze.com 2023-02-20 02:44 出处:网络
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 pac开发者_Go百

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 pac开发者_Go百科kages 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.


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消