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.devel Subject: Re: truth of %nil Date: Thu, 2 Jul 2009 10:28:25 -0400 Message-ID: <20090702142823.GA1401@fibril.netris.org> References: <87k52uvhnt.fsf@arudy.ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1246545054 27069 80.91.229.12 (2 Jul 2009 14:30:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jul 2009 14:30:54 +0000 (UTC) Cc: Andy Wingo , guile-devel To: Neil Jerram Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 02 16:30:47 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MMNJF-00066y-Ez for guile-devel@m.gmane.org; Thu, 02 Jul 2009 16:30:45 +0200 Original-Received: from localhost ([127.0.0.1]:47817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MMNJE-00069q-SR for guile-devel@m.gmane.org; Thu, 02 Jul 2009 10:30:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MMNHx-0004bY-L3 for guile-devel@gnu.org; Thu, 02 Jul 2009 10:29:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MMNHs-0004U3-UK for guile-devel@gnu.org; Thu, 02 Jul 2009 10:29:25 -0400 Original-Received: from [199.232.76.173] (port=48503 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MMNHs-0004Th-PN for guile-devel@gnu.org; Thu, 02 Jul 2009 10:29:20 -0400 Original-Received: from world.peace.net ([204.107.200.8]:44149) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MMNHs-000296-G7 for guile-devel@gnu.org; Thu, 02 Jul 2009 10:29:20 -0400 Original-Received: from localhost ([127.0.0.1] helo=fibril.netris.org ident=hope4) by world.peace.net with esmtp (Exim 4.69) (envelope-from ) id 1MMNH5-000167-CL; Thu, 02 Jul 2009 10:28:33 -0400 Content-Disposition: inline In-Reply-To: <87k52uvhnt.fsf@arudy.ossau.uklinux.net> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8823 Archived-At: I've been considering writing a python compiler for guile. For python (and others) there are several values considered to be false, such as 0 and various empty collections, and so a different approach will have to be taken to this problem. If we want guile to handle many different languages, should we not try to find an approach to "false-ness" that handles many languages, and not just a few? It seems to me that some code might misbehave in the presence of two values which are both null? but not eq? to each other. Also, it seems more consistent to use the same strategy for handling various languages' notions of false-ness. To my mind, we should not be changing the data (which only works for lisp), but rather the constructs that decide whether a given value is false. So how about having elisp `if' and `cond' compile not to scheme `if' and `cond', but rather to scheme `elisp-if' and `elisp-cond'? Or perhaps compile `(if c a b)' to `(if (elisp-true? c) a b)'. This approach, unlike the %nil approach, will work for other languages too. It also means that Guile's normal `if' and `cond' won't be slowed down by having to check for two values instead of one. That overhead may be insignificant now, but when we have a native code compiler, it will be quite significant in code size at least, even if the representations of %nil and #f differ by only one bit. What do you think? Mark On Mon, Jun 29, 2009 at 10:44:54PM +0100, Neil Jerram wrote: > Seems wrong to me. In Scheme #f should be the only false value. > What's the argument for %nil being false in Scheme code?