From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#14164: letrec: detect illegal accesses to vars before entering body Date: Tue, 09 Apr 2013 12:44:07 -0400 Message-ID: <87wqsbd57s.fsf@tines.lan> References: <877gkcuxi7.fsf@karetnikov.org> <87bo9oe14d.fsf@tines.lan> <87mwt8p5u5.fsf@karetnikov.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365525935 2262 80.91.229.3 (9 Apr 2013 16:45:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Apr 2013 16:45:35 +0000 (UTC) Cc: 14164@debbugs.gnu.org To: Nikita Karetnikov Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Apr 09 18:45:38 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UPbfr-0001ez-Oc for guile-bugs@m.gmane.org; Tue, 09 Apr 2013 18:45:35 +0200 Original-Received: from localhost ([::1]:48091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPbfr-0001tb-A4 for guile-bugs@m.gmane.org; Tue, 09 Apr 2013 12:45:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPbfk-0001n9-Ms for bug-guile@gnu.org; Tue, 09 Apr 2013 12:45:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPbff-0001fj-W7 for bug-guile@gnu.org; Tue, 09 Apr 2013 12:45:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPbff-0001ff-Tg for bug-guile@gnu.org; Tue, 09 Apr 2013 12:45:23 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UPbjC-0000Qu-7n for bug-guile@gnu.org; Tue, 09 Apr 2013 12:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 09 Apr 2013 16:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14164 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 14164-submit@debbugs.gnu.org id=B14164.13655260851582 (code B ref 14164); Tue, 09 Apr 2013 16:49:02 +0000 Original-Received: (at 14164) by debbugs.gnu.org; 9 Apr 2013 16:48:05 +0000 Original-Received: from localhost ([127.0.0.1]:42171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UPbiG-0000PT-Eu for submit@debbugs.gnu.org; Tue, 09 Apr 2013 12:48:04 -0400 Original-Received: from world.peace.net ([96.39.62.75]:35637) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UPbiD-0000P1-Be for 14164@debbugs.gnu.org; Tue, 09 Apr 2013 12:48:02 -0400 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UPbeZ-00078a-Rp; Tue, 09 Apr 2013 12:44:16 -0400 In-Reply-To: <87mwt8p5u5.fsf@karetnikov.org> (Nikita Karetnikov's message of "Tue, 09 Apr 2013 10:37:38 +0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7080 Archived-At: Nikita Karetnikov writes: >>> According to the manual [1], this snippet: >>> >>> (letrec ((a 42) >>> (b (+ a 10))) >>> (* a b)) >>> >>> should return "Error: unbound variable: a." > >> The manual doesn't say anything nearly that specific. > > Either you missed it or I misunderstood this sentence. So if you missed > it, it can be found below 'syntax: letrec* bindings body'. Oops! You're right, of course. Apologies for saying you were wrong. I'll fix the manual. >> In general, if the manual says you "may not" do something, or if the >> R5RS says "it is an error", that means that if you do, the results are >> unspecified. > > Are you talking about the result of 'letrec' or 'b'? Anyway, why does > it return 2184 if the results are unspecified? Could you elaborate? Well, first of all, I misspoke. In this case, I should have said (as the R5RS did) that "it is an error", which in Scheme-standard-speak means "anything at all could happen". This is different from "an error is signaled" or "an error is raised" or "an exception is thrown" which consitutes a promise to report an error. When the standard (or the manual) says "the result is unspecified", that means that some value will be returned, but that value could be anything. Although Guile includes a distinguished value shown as "*unspecified*", which is often used in these cases, it is not always used. In practice, we use it when we can easily do so without imposing a runtime cost, as a debugging aid. However, it is not always used. Thanks, Mark