I am running into another issue involving file loading order.
node.lisp contains the following line: (defvar *current-node* (make-instance 'local-node))
Now that nodes are more than just an empty class (each node has a system-manager), there is a need to call functions while creating node instances (such as spawn).
Is it okay to have circular dependencies in asdf? (:file "node" :depends-on ("package" "process")) (:file "process" :depends-on ("package" "mailbox" "node" "compatibility"))
On 9220 day of my life Eric Lavigne wrote:
I am running into another issue involving file loading order.
node.lisp contains the following line: (defvar *current-node* (make-instance 'local-node))
Note that it is runtime dependence, not compile-time. But it doesn't matter much.
Is it okay to have circular dependencies in asdf?
No. In which order the files should be loaded? "node" cannot be loaded before "process" because it instantiate class defined later. "process" cannot be loaded before "node" because it depends on "node".
I think you should move class definitions to separate file. Or join "node" and "process".
Eric Lavigne wrote:
node.lisp contains the following line: (defvar *current-node* (make-instance 'local-node))
Now that nodes are more than just an empty class (each node has a system-manager), there is a need to call functions while creating node instances (such as spawn).
The variable *CURRENT-NODE* is not part of the API. (I know, it's hard to tell without a proper DEFPACKAGE form or documentation...) The function CURRENT-NODE is, part of the API, and you can just change it like this:
(defvar *current-node* nil)
(defun current-node () (when (null *current-node*) (setq *current-node* ...)) *current-node*)
Is it okay to have circular dependencies in asdf?
Most definately not. The dependency graph undergoes a topological sort, and the resulting ordering is the order in which the files are loaded. With cycles in the graph, no topological ordering exists.
- Dirk