Hello,
The function postmodern:connected-p should fail when its argument is a variable bounded to nil? For instance, here is some code using the package :postmodern :
(defun connect-to-database () (when (not (connected-p *database*)) (connect-toplevel *db-name* *db-user* *db-pass* *db-host*)))
This code fails because *database* is nil at first.
If the function cl-postgress:database-open-p was changed into this:
(defun database-open-p (connection) "Returns a boolean indicating whether the given connection is currently connected." (and connection (connection-socket connection) (open-stream-p (connection-socket connection))))
the code above would work as expected.
Hello Renato,
The function postmodern:connected-p should fail when its argument is a variable bounded to nil?
Yes, I think it should. It is defined on connection objects, nothing else. Having it take NIL might be convenient, but that kind of tricks are the road to (*shrudder*) a Perl-like mess of shortcuts and bizarre rules. Just use (AND *DATABASE* (CONNECTED-P *DATABASE*)) in your code.
Regards, Marijn
postmodern-devel@common-lisp.net