Greg, Recursive functions always make my brain hurt, but I don't think this shows what you are talking about. The reason that the $$FACT^ZZGBAD(5)=1 is because your function returns VAL, which got set to 1 after the recursive calls down to MYN=0. I don't think there is anything funny like passed parameters being changed.
My understanding is that variables are given a NEW when the function starts. Kevin --- Greg Woodhouse <[EMAIL PROTECTED]> wrote: > Sure. > > > >ZL ZZGBAD ZP > FACT(MYN) ; ; 3/8/05 12:14pm > Q:MYN'>0 1 > S VAL=$$FACT(MYN-1) > S MYN=0 ;MYN changed! > Q VAL > > >W $$FACT^ZZGBAD(5) > 1 > > > > > --- Greg Kreis <[EMAIL PROTECTED]> wrote: > > > I am not following your reasoning Greg. Can you > provide an example? > > > > Greg Woodhouse wrote: > > > > >Another thing to watch out for is recursive > calls. With the scoping > > >works in MUMPS it seems to me that the only safe > option is to copy > > >parameter values into NEW variables (so that you > have a separate > > copy > > >in each stack frame). Otherwise, things might not > work as you > > expect. > > > > > >--- Greg Woodhouse <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > >>In fact, I recall creating a special lookup > routine that called > > ^DIC > > >>-- > > >>except that I neglected to include the "I" flag > for ignore special > > >>lookup routine. Needless to say, the result was > "interesting". > > >> > > >>--- Greg Kreis <[EMAIL PROTECTED]> > wrote: > > >> > > >> > > >> > > >>>It can happen with repeatedly performing a DO > command to any > > >>>location. > > >>>Anything that is putting new entries on the > stack frame without > > >>>eventually removing them. The stack on DSM or > Cache can probably > > >>>handle > > >>>300+ entries, so it never overflows with > legitimate logic. ;-) > > >>> > > >>>Greg Woodhouse wrote: > > >>> > > >>> > > >>> > > >>>>It means there was an intepreter stack > overflow. :-) > > >>>> > > >>>>Actually, I think you got into an infinite > loop making repeated > > >>>> > > >>>> > > >>>routine > > >>> > > >>> > > >>>>calls (each of which requires the allocation > of a new stack > > frame, > > >>>>which contains such details as NEW variables > and the return > > >>>> > > >>>> > > >>>address). > > >>> > > >>> > > >>>>--- "Naik, Chintan (EDS)" > <[EMAIL PROTECTED]> wrote: > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>>>Anyone know what this error means? > > >>>>> > > >>>>>%DSM-E-STKOVR, Interpreter stack overflow > > >>>>> > > >>>>> > > >>>>>Thanks, > > >>>>> > > >>>>>Chintan Naik > > >>>>>Health System Design & Development > > >>>>>* (972)-796-2414 - (Plano - Tue, Wed, Thu) > > >>>>>* (817)-798-0546 - (Dallas OIFO - Mon, Fri) > > >>>>>* Fax: (972)-796-6181 > > >>>>>* mailto:[EMAIL PROTECTED] > > >>>>> > > >>>>>To care for him who shall have borne the > battle and for his > > widow > > >>>>> > > >>>>> > > >>>and > > >>> > > >>> > > >>>>>his orphan... Abraham Lincoln > > >>>>> > > >>>>>Enrollment Systems Group... Where VA Health > Care Begins! > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > > >>>>>------------------------------------------------------- > > >>>>>SF email is sponsored by - The IT Product > Guide > > >>>>>Read honest & candid reviews on hundreds of > IT Products from > > real > > >>>>>users. > > >>>>>Discover which products truly live up to the > hype. Start reading > > >>>>> > > >>>>> > > >>>now. > > >>> > > >>> > > > >>>>>http://ads.osdn.com/?ad_ide95&alloc_id396&op=click > > > >>>>>_______________________________________________ > > >>>>>Hardhats-members mailing list > > >>>>>Hardhats-members@lists.sourceforge.net > > > >>>>>https://lists.sourceforge.net/lists/listinfo/hardhats-members > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>===== > > >>>>A practical man is a man who practices the > errors of his > > >>>> > > >>>> > > >>>forefathers. --Benjamin Disraeli > > >>> > > >>> > > >>>>==== > > >>>>Greg Woodhouse > > >>>>[EMAIL PROTECTED] > > >>>>[EMAIL PROTECTED] > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > > >>>>------------------------------------------------------- > > >>>>SF email is sponsored by - The IT Product > Guide > > >>>>Read honest & candid reviews on hundreds of IT > Products from real > > >>>> > > >>>> > > >>>users. > > >>> > > >>> > > >>>>Discover which products truly live up to the > hype. Start reading > > >>>> > > >>>> > > >>>now. > > >>> > > >>> > > > >>>>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > > > >>>>_______________________________________________ > > >>>>Hardhats-members mailing list > > >>>>Hardhats-members@lists.sourceforge.net > > > >>>>https://lists.sourceforge.net/lists/listinfo/hardhats-members > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>===== > > >>A practical man is a man who practices the > errors === message truncated === __________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Hardhats-members mailing list Hardhats-members@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hardhats-members