I think you're missing my point.  It's that the error is referring to COMPILE when I called LOAD.
"Not getting an error" was not was the goal!



On Tue, Oct 15, 2013 at 3:03 PM, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
Douglas Katzman <dougk@google.com> writes:

> File foo.lisp:
>
> (unless (find-package "FRED")
>   (make-package "FRED" :use '("CL")))
> (defun try (x)
>   (fred:some-fn x))
>
> --
> * (load "/tmp/foo.lisp")
>
> debugger invoked on a SB-C::INPUT-ERROR-IN-COMPILE-FILE in thread
> #<THREAD "main thread" RUNNING {1002ACB573}>:
>   READ error during COMPILE-FILE:
>
>     Symbol "SOME-FN" not found in the FRED package.
>
>       Line: 6, Column: 15, File-Position: 99
>
>       Stream: #<SB-SYS:FD-STREAM for "file /private/tmp/foo.lisp"
> {100325E1C3}>

Indeed.  Rather, try:

(eval-when (:compile-toplevel :load-toplevel :execute)
  (unless (find-package "FRED")
    (make-package "FRED" :use '("CL"))))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (export 'fred::some-fn "FRED"))

(declaim (ftype (function (t) t) fred:some-fn))

(defun try (x)
  (fred:some-fn x))

--
__Pascal Bourguignon__
http://www.informatimago.com/