From: Michael Glass

Subject: with-open-file in ACL/Win 3.0

Date: 1998-10-19 23:28


I'm having a problem with with-open-file in ACL/Win 3.0.  If the file
does not exist, the program aborts.

Macroexpanding a trivial example shows the problem.

Original code:
   (with-open-file (str "foo" :direction :input :if-does-not-exist nil))

Expanded:
   (LET
     ((STR (OPEN "foo" :DIRECTION :INPUT :IF-DOES-NOT-EXIST NIL)))
     (UNWIND-PROTECT
      (PROGN)
      (CLOSE STR)))

When the file doesn't exist (CLOSE NIL) executes, causing death. 

Clearly I can abandon with-open-file and write something more
bullet-proof, but I have a feeling something is really wrong here. 

Maybe I am doing something wrong?

Maybe with-open-file is different in version 5?  (I won't convert to
version 5 for another month.  I don't want to switch in the middle of an
experiment.) 

-- Michael Glass
   <steve.iit.edu at glass>