[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Your WRITE macro and GRINDEF



The reason that GRINDEF fails after you use your write macro is that
leave OUTFILES bound to a list of a closed file object.  The correct
thing to do is:

    (defun write macro (n)		;(write <file> <s-exp>)
           `((lambda (outfiles ^r ^w)
		     ,(caddr n)
		     (close (car outfiles)))
	     (list (open ,(cadr n) 'out)) t t))
You should almost always lambda-bind ^W or ^R in a program (though
at top-level you usually setq them).  This prevents screws like the one you
experience with GRINDEF.  GRINDEF is wrong, though (JONL take note) as
it should only look at OUTFILES if ^R is non-NIL.

--Howard