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: Wed, 08 Jul 2009 09:17:26 -0400 Message-ID: References: <20090707111406.GA1388@fibril.netris.org> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1247059557 3264 80.91.229.12 (8 Jul 2009 13:25:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jul 2009 13:25:57 +0000 (UTC) Cc: Andy Wingo , Neil Jerram , guile-devel To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jul 08 15:25:50 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 1MOX9h-0005ON-4b for guile-devel@m.gmane.org; Wed, 08 Jul 2009 15:25:49 +0200 Original-Received: from localhost ([127.0.0.1]:44421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOX9g-0007du-Hd for guile-devel@m.gmane.org; Wed, 08 Jul 2009 09:25:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOX1p-0001as-9r for guile-devel@gnu.org; Wed, 08 Jul 2009 09:17:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOX1k-0001Uv-IV for guile-devel@gnu.org; Wed, 08 Jul 2009 09:17:40 -0400 Original-Received: from [199.232.76.173] (port=53164 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOX1j-0001UH-Qc for guile-devel@gnu.org; Wed, 08 Jul 2009 09:17:35 -0400 Original-Received: from world.peace.net ([204.107.200.8]:48005) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MOX1j-00061Q-7Y for guile-devel@gnu.org; Wed, 08 Jul 2009 09:17:35 -0400 Original-Received: from mhw by world.peace.net with local (Exim 4.69) (envelope-from ) id 1MOX1a-00072X-Cw; Wed, 08 Jul 2009 09:17:26 -0400 In-reply-to: Your message of "Tue, 07 Jul 2009 07:14:09 EDT." <20090707111406.GA1388@fibril.netris.org> 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:8851 Archived-At: I've discovered two more tests that can be optimized using the same bit masking tricks: scm_is_bool and scm_is_bool_or_lisp_nil (newly created). Since SCM_BOOL_F and SCM_BOOL_T differ by only one bit, that one is easy. The other one can be implemented the same way as scm_is_lisp_false in my last proposal, by making IFLAG 5 another never-to-be-used value. That way, IFLAGS 0/1/4/5 (#f %nil #t dont-use-2) are all the same except for two bit positions. So I was thinking that scm_is_bool and scm_is_bool_or_lisp_nil could be implemented as macros, which are as fast and as compact as testing for boolean truth. What do you think? Also, since writing my last email, I've realized that my testing macros need to use SCM_UNPACK. I'm currently in the process of preparing a patch. As part of that process, I'm reviewing all uses of the affected macros, and evaluating for each use case how %nil should be handled. In order to remain flexible with regards my other pending proposal, I'm forking macros into two variants: one which checks for %nil when appropriate, and one which doesn't. We can decide what their names should be later. I found one thorny use of scm_is_bool and scm_is_null, and request your collective wisdom: scm_class_of() in goops.c tries to determine the class of a scheme value. If scm_is_bool returns true, it's classified as scm_class_boolean, and if scm_is_null returns true, it's classified as scm_class_null. Right now, that code doesn't consider %nil at all. How do you all think %nil should be handled by goops? It seems to me that it would be nice to try to support %nil transparently when possible. Mark