Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site umcp-cs.UUCP Path: utzoo!linus!decvax!harpo!seismo!rlgvax!cvl!umcp-cs!chris From: chris@umcp-cs.UUCP Newsgroups: net.emacs Subject: Re: bug in arg passing Message-ID: <1794@umcp-cs.UUCP> Date: Sat, 13-Aug-83 02:50:26 EDT Article-I.D.: umcp-cs.1794 Posted: Sat Aug 13 02:50:26 1983 Date-Received: Sat, 13-Aug-83 19:14:20 EDT References: <866@pur-phy.UUCP> Organization: Univ. of Maryland, Computer Science Dept. Lines: 39 That's not a bug, it's a feature! :-) The problem is that everything is a FEXPR (if I have my lisp terminology correct): (defun (foo1 z (setq z 10) (foo2 z))) (defun (foo2 z (message "z = " z))) exhibits the same problem. ("z = 0") The fix I have decided on is to write such functions as (defun (foo1 arg1 (setq arg1 (arg 1)) (progn max-attempts i (setq max-attempts arg1) . . . In other words, all arguments will put into be "arg1", "arg2", . . . up until the actual code itself, which will be inside a progn which declares the real variable names, and then moves the "arg"s to the real variables. This is essentially doing by hand what a real lisp system would do for you (evaluating arguments before binding new variables). - Chris PS You can even write recursive MLisp code this way! (shudder) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris.umcp-cs@UDel-Relay