Re: Transcribe-file handles bad input badly

JP Massar <[email protected]>
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
A
> > (defun transcribe-file (in-file out-file
> >                               &optional (package :common-lisp-user)
> >                                         (prettyp t))
>
> >   (when (string-equal in-file out-file)
> >     (error "Input and output file names are the same."))
> >   (let ((*package* (find-package package)))...
>
>So I guess *package* gets bound to nil if there is (one would hope!) no
>package named package. This seems to make transcribe-file go away and
>not come back.


Binding *package* to NIL could be considered a bad idea

:-)

For instance, this hangs

(let ((*package* nil)) (intern "FOO"))

and this hangs

(let ((*package* nil)) (error "Bad package: ~A" nil))

but interestingly, this does not:

(let ((*package* nil)) (error "OOPS"))

Since *PACKAGE* can only legitimately be bound to a package,
with presumably undefined consequences resulting if not,
code which binds it must insure that this is so.

So to fix TRANSCRIBE-FILE

(let* ((p (find-package package))
         (*package* (or (and (packagep p) p)) (error "Not a known package: 
~A" package)))
         ...



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/SyjtlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.