ruricolist / overlord

Build system in Common Lisp
MIT License
60 stars 2 forks source link

Undefined variable during compilation #3

Closed phoe closed 6 years ago

phoe commented 6 years ago

File in question: https://github.com/phoe/gateway/blob/master/install/install.lisp#L12 Evaluating (asdf:load-system :gateway :force t) produces the following compile-time warning:

...
; file: /home/phoe/Projects/Lisp/gateway/install/install.lisp
; in: DEFUN GATEWAY/INSTALL:RELOAD
;     (OVERLORD/IMPORTING:IMPORT GATEWAY/INSTALL::MY-QUERIES
;       :FROM
;       #P"/home/phoe/Projects/Lisp/gateway/install/install.sql"
;       :AS
;       :CL-YESQL/POSTMODERN
;       :BINDING
;       :ALL-AS-FUNCTIONS)
; --> PROGN MACROLET OVERLORD/IMPORTING::IMPORT-BINDINGS PROGN PROGN 
; --> OVERLORD/SHADOWS:DEFUN DEFUN PROGN SB-IMPL::%DEFUN 
; --> SB-INT:NAMED-LAMBDA FUNCTION MULTIPLE-VALUE-PROG1 PROGN BLOCK 
; --> APPLY MULTIPLE-VALUE-CALL SB-KERNEL:%COERCE-CALLABLE-TO-FUN 
; --> OVERLORD/MODULE:MODULE-FN-REF/INLINE-CACHE LOCALLY LET* THE IF 
; ==>
;   (OVERLORD/MODULE::FILL-INLINE-CACHE/FN #:INLINE-CACHE6
;                                          GATEWAY/INSTALL::MY-QUERIES
;                                          ':DROP-TABLES)
; 
; caught WARNING:
;   undefined variable: GATEWAY/INSTALL::MY-QUERIES
; 
; compilation unit finished
;   Undefined variable:
;     GATEWAY/INSTALL::MY-QUERIES
;   caught 1 WARNING condition

The file works normally when ran. I just want to get rid of that compiler warning.

ruricolist commented 6 years ago

The problem is that overlord:import is meant to be used at the top level. The code should look something like this:

(overlord:import my-queries
  :from #.(asdf:system-relative-pathname :gateway "install/install.sql")
  :as :cl-yesql/postmodern
  :binding :all-as-functions)

(defun reload ()
  (overlord:build 'my-queries))

Since this wasn't documented, I added a page about it to the wiki.

phoe commented 6 years ago

Thanks!