Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cica!iuvax!purdue!haven!decuac!shlump.nac.dec.com!level.dec.com!batcheldern
From: batcheldern@level.dec.com (Ned Batchelder)
Newsgroups: comp.lang.postscript
Subject: Re: Interesting Bug
Message-ID: <4079@shlump.nac.dec.com>
Date: 15 Aug 89 19:25:43 GMT
References: <1365@intercon.UUCP> <2106@optilink.UUCP>
Organization: DEC
Lines: 16

PostScript will recognize that it is in an infinite recursion. This is
one case where it won't, though, because they've implemented tail
recursion. In other words, if the last thing a procedure does is call
another procedure, instead of pushing the new procedure on the execution
stack, the interpreter simply replaces the old procedure with the new
procedure. This saves an entry on the execution stack, and also a little
bit of time modifying pointer, checking bounds, etc.

If your procedure had been

	/L { L 1 pop } def

then you would have quickly received an execstackoverflow error.


Ned Batchelder, Digital Equipment Corp., BatchelderN@Hannah.DEC.com