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: Re: typechecking Date: Sun, 30 May 2004 10:40:09 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <40B99DE9.8010005@dirk-herrmanns-seiten.de> References: <16486.52591.672130.224861@localhost.localdomain> <87brkwc6f7.fsf@zagadka.ping.de> <16544.2271.454230.492574@localhost.localdomain> <40A5DFF2.80004@dirk-herrmanns-seiten.de> <16564.54949.13882.819772@localhost.localdomain> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1085904840 6426 80.91.224.253 (30 May 2004 08:14:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 30 May 2004 08:14:00 +0000 (UTC) Cc: guile-devel@gnu.org, Marius Vollmer Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun May 30 10:13:49 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BULS0-0007eH-00 for ; Sun, 30 May 2004 10:13:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BULS8-0002eI-Db for guile-devel@m.gmane.org; Sun, 30 May 2004 04:13:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BULRw-0002dA-AK for guile-devel@gnu.org; Sun, 30 May 2004 04:13:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BULRu-0002bC-0s for guile-devel@gnu.org; Sun, 30 May 2004 04:13:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BULRt-0002az-QI for guile-devel@gnu.org; Sun, 30 May 2004 04:13:41 -0400 Original-Received: from [212.227.126.189] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BULRc-0005Dp-8f for guile-devel@gnu.org; Sun, 30 May 2004 04:13:24 -0400 Original-Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1BULRb-0008F8-00; Sun, 30 May 2004 10:13:23 +0200 Original-Received: from [80.131.45.114] (helo=dirk-herrmanns-seiten.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1BULRb-0007gh-00; Sun, 30 May 2004 10:13:23 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040220 X-Accept-Language: de, en Original-To: hanwen@xs4all.nl In-Reply-To: <16564.54949.13882.819772@localhost.localdomain> X-Enigmail-Version: 0.76.8.0 X-Enigmail-Supports: pgp-inline, pgp-mime X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:494e3e4d1bf8dc247959c49e6f1f4215 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3774 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3774 Han-Wen Nienhuys wrote: >dirk@dirk-herrmanns-seiten.de writes: > > >>Code like the following: >> >>void f (SCM obj) >>{ >> if (obj) { >> /* do something */ >> } >>} >> >>is almost always wrong, since what the user typically wants to check is, >>whether obj is SCM_BOOL_F or not: >> >> > >It would be interesting to see if we could map the Scheme semantics >(true = !SCM_BOOL_F) to C. That would require mapping SCM_BOOL_F to >(void*)0x0. Is this desirable, and does anyone see a possibility for this? > SCM values, where the 3 least significant bits are zero indicate non-immediates. That is, the SCM value can without any modification be used as a pointer to a scm_t_cell object on the heap. This works, since scm_t_cell has at least 8 bytes and thus the heap is constructed such that all scm_t_cell objects are placed on an address that is a multiple of 8. SCM_BOOL_F on the contrary is an immediate value. To make SCM_BOOL_F == 0x00 would require either to introduce it as a special case and leave otherwise the definitions of non-immediates the same, or to change the type system such that non-immediates are characterised differently. Both solutions, however, would require to perform some operation on every access to the heap. On the contrary, they would make all comparisons against SCM_BOOL_F very simple and also help to avoid some errors. The effects of such a change are difficult to predict. It may be that it is not too much effort to try it out (at least the special case solution), if everywhere the correct access macros are used (SCM_IMP, SCM_FALSEP, ...). Then, for a try you would only have to change those. Best regards Dirk _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel