From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20678 invoked from network); 18 Jun 2006 14:06:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 Jun 2006 14:06:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 10725 invoked from network); 18 Jun 2006 14:06:34 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Jun 2006 14:06:34 -0000 Received: (qmail 25157 invoked by alias); 18 Jun 2006 14:06:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22500 Received: (qmail 25148 invoked from network); 18 Jun 2006 14:06:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 18 Jun 2006 14:06:30 -0000 Received: (qmail 10310 invoked from network); 18 Jun 2006 14:06:30 -0000 Received: from vms040pub.verizon.net (206.46.252.40) by a.mx.sunsite.dk with SMTP; 18 Jun 2006 14:06:28 -0000 Received: from torch.brasslantern.com ([71.116.105.50]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J1200GYU76QXN08@vms040.mailsrvcs.net> for zsh-workers@sunsite.dk; Sun, 18 Jun 2006 09:06:27 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k5IE6Pid000848 for ; Sun, 18 Jun 2006 07:06:25 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k5IE6PnS000847 for zsh-workers@sunsite.dk; Sun, 18 Jun 2006 07:06:25 -0700 Date: Sun, 18 Jun 2006 07:06:25 -0700 From: Bart Schaefer Subject: Re: Recursion error and line numbers In-reply-to: <200606181238.k5ICcCXY007519@pwslaptop.csr.com> To: zsh-workers@sunsite.dk Message-id: <060618070625.ZM846@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <200606181238.k5ICcCXY007519@pwslaptop.csr.com> Comments: In reply to Peter Stephenson "Re: Recursion error and line numbers" (Jun 18, 1:38pm) On Jun 18, 1:38pm, Peter Stephenson wrote: } Subject: Re: Recursion error and line numbers } } On the two PCs I tried this on (neither particularly antiquated) it } crashed, so the maximum function depth of 4096 isn't limited enough. I have 3GB RAM + 6GB swap on my home machine now (total overkill for most of what it does) so I'm probably not a good test case for this kind of thing any more ... } How about 1000? That seems to stop it. It looks as if it's been 4096 ever since we added it back in about April 2000. A default of 1000 is most likely OK, given that it's configure-time settable. What we need is something like perl's "goto &routine;" to implement a tail-call optimization. Of course, that just turns it into an infinite loop. } > Obviously the recursion depth isn't 1 or 10 or 50 either. Where is that } > number coming from? I would have expected "1" in all cases. } } It's a subtle effect of line number handling and I haven't quite worked } out why yet. Perhaps it has something to do with having left off the braces around the function body? Compare: torch% deep() deep torch% deep deep:2: maximum nested function level reached torch% deep() { deep } torch% deep deep: maximum nested function level reached torch% deep() function> deep torch% deep deep:7: maximum nested function level reached torch% deep() function> { deep } torch% deep deep:1: maximum nested function level reached Note that without the braces, the line numbers seem to be counting the number lines of input that have been read; the number must be coming in from the surrounding scope.