Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!umcp-cs!nbs-amrf!manheime From: manheime@nbs-amrf.UUCP (Ken Manheimer) Newsgroups: net.emacs Subject: Re: Re: MLisp in Gosling's Message-ID: <375@nbs-amrf.UUCP> Date: Sun, 3-Aug-86 23:53:05 EDT Article-I.D.: nbs-amrf.375 Posted: Sun Aug 3 23:53:05 1986 Date-Received: Mon, 4-Aug-86 07:26:09 EDT References: <1514@vax135.UUCP> <916@unirot.UUCP> <371@nbs-amrf.UUCP> <2713@umcp-cs.UUCP> Organization: National Bureau of Standards Lines: 43 > In article <371@nbs-amrf.UUCP> manheime@nbs-amrf.UUCP (Ken Manheimer) writes: > >The binding scheme is important. [The one in MLisp] can be > >very insidious and have enourmous impact on applications. > >You lose recursion ... to the Mlisp binding bug. > > Actually, it *is* possible to write recursive routines. You have > to use a two-stage argument evaluation method: > > (defun foo $foo-arg1 > (setq $foo-arg1 (arg 1)) > (progn $foo-local-var > (setq $foo-local-var $foo-arg1) > ...)) > -- > In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) > UUCP: seismo!umcp-cs!chris > CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu You might as well just forget explicitly passing the value to the subordinate invocation of the function and instead call a helper function that uses a single "state" variable over the duration of its multiple incursions. Eg: (defun fooMain $foo-arg (setq $foo-arg (arg 1)) (...) ;;; miscellaneous foo preparation (fooHelper)) (defun fooHelper (xxx $foo-arg) ;;; miscellaneous operations on/wrt $foo-arg (if (fooPred $foo-arg) (fooHelper)) ...) I think you can do the same thing in fortran (?). I'd hate to write a substantial suite of programs where you had to worry about this kind of finagling, though. (Come to think of it, i have done a lot of hacking on, um, rmail, info, ..., and this certainly was at times a pain. Doable, but not pleasant, and it certainly engenders a weird contortion to the code...) Ken. ...!seismo!nbs-amrf!manheime