From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dirk Herrmann Newsgroups: gmane.lisp.guile.devel Subject: Again: illegal uses of define in guile Date: Mon, 4 Nov 2002 22:57:09 +0100 (CET) Sender: guile-devel-admin@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1036447659 24437 80.91.224.249 (4 Nov 2002 22:07:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 4 Nov 2002 22:07:39 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 188pNd-0006LV-00 for ; Mon, 04 Nov 2002 23:07:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 188pMn-0001GO-00; Mon, 04 Nov 2002 17:06:41 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 188pDi-0006kY-00 for guile-devel@gnu.org; Mon, 04 Nov 2002 16:57:18 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 188pDd-0006it-00 for guile-devel@gnu.org; Mon, 04 Nov 2002 16:57:16 -0500 Original-Received: from sallust.ida.ing.tu-bs.de ([134.169.132.52]) by monty-python.gnu.org with esmtp (Exim 4.10) id 188pDc-0006ie-00 for guile-devel@gnu.org; Mon, 04 Nov 2002 16:57:12 -0500 Original-Received: from localhost (dirk@localhost) by sallust.ida.ing.tu-bs.de (8.9.3+Sun/8.9.1) with ESMTP id WAA20720 for ; Mon, 4 Nov 2002 22:57:09 +0100 (CET) Original-To: guile-devel@gnu.org Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1642 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1642 Hi folks, we have been discussing the question of illegal uses of define in guile, especially code like (if (define foo bar)) and have come to the conclusion that we want to support such code. Thus, we have come up with the following conclusions: > Summarized: > * The compiler must be able to emit code that allows references to > identifiers to be looked up at use time (that is, in the executor). > * The executor must be able to handle definitions. > * Once a binding has been referenced, the binding should not change. But, there is one thing about such code which needs to be clarified: How should the following code be translated: (begin (define => 'foo) (cond (#t => 'ok))) According to R5RS the result should be 'ok (see section 4.3.2 pattern language). This, however, requires some intelligence when handling with top-level forms: Top level forms would need to be split up into separate definitions and expressions before each separate definition and expression is memoized and executed. This is easily possible when using the R5RS restriction that top level definitions may not be used within any construct except possibly nested within 'begin's. If we allow top level definitions also to be performed within 'if's and other stuff, there is the question, how the following expression should be evaluated: (if (begin (define => 'foo)) (cond (#t => 'ok)))) To handle this in the 'expected' way is difficult: The form would have to be split up such that the definition was performed before the syntax transformation of the cond-expression was performed. Things can be even more complicated: (if (begin (if (define => 'foo)) (cond (#t => 'ok)))) To handle such stuff consistently is quite complicated. One possible solution is to never memoize top-level forms, but always interpret them. Only lambda forms would then be memoized. This, however, makes evaluating code quite complicated: We would need an interpreter of non-memoized top level forms, and an interpreter for memoized non top level forms. Hmmm? Best regards, Dirk Herrmann _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel