From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: tomas@fabula.de Newsgroups: gmane.lisp.guile.devel Subject: Re: Smart variables, dumb variables Date: Wed, 14 Aug 2002 10:07:15 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <20020814080715.GA6068@www> References: <87y9bajzfp.fsf@zagadka.ping.de> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1029311659 30250 127.0.0.1 (14 Aug 2002 07:54:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 14 Aug 2002 07:54:19 +0000 (UTC) Cc: guile-devel@gnu.org 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 17esyv-0007rf-00 for ; Wed, 14 Aug 2002 09:54:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17eszj-0003Qk-00; Wed, 14 Aug 2002 03:55:07 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17eszY-0003PU-00 for guile-devel@gnu.org; Wed, 14 Aug 2002 03:54:56 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17eszW-0003Oo-00 for guile-devel@gnu.org; Wed, 14 Aug 2002 03:54:55 -0400 Original-Received: from www.elogos.de ([212.18.192.92]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17eszV-0003Oj-00 for guile-devel@gnu.org; Wed, 14 Aug 2002 03:54:53 -0400 Original-Received: by www.elogos.de (Postfix, from userid 5002) id E29CC1049BF; Wed, 14 Aug 2002 10:07:15 +0200 (CEST) Original-To: Marius Vollmer Content-Disposition: inline In-Reply-To: <87y9bajzfp.fsf@zagadka.ping.de> User-Agent: Mutt/1.3.24i 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:1076 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1076 On Tue, Aug 13, 2002 at 10:06:50PM +0200, Marius Vollmer wrote: > Hi, > > currently, our global variables are strictly passive containers. [...] > I would add a 'flags' field to variable smob (there is room for it), > with the following flags defined initially: > > - SCM_F_VARIABLE_DUMB > > When set, the variable is 'dumb' and can be referened and set > with SCM_DUMB_VARIABLE_REF and SCM_DUMB_VARIABLE_SET, > respectively. When it is not set, you need to call > scm_variable_ref and scm_variable_set_x. > > - SCM_F_VARIABLE_READONLY > > When set, the variable can not be set. You are not allowed to > use SCM_DUMB_VARIABLE_SET and scm_variable_set_x will result in > an error. An attractive idea, indeed. Let's see whether there are objections from the `language theorists' out there. I'd propose a slight modification, though: use one flag for the setter, one for the getter, like so: - SCM_F_VARIABLE_DUMB_GETTER When set, the variable has a `dumb' getter and can be referenced with SCM_DUMB_VARIABLE_REF. Otherwise you need to reference it with scm_variable_ref. - SCM_F_VARIABLE_DUMB_SETTER When set, the variable has a `dumb' setter and can be referenced with SCM_DUMB_VARIABLE_SET. Otherwise you need to set it with scm_variable_set_x. It looks more symmetric ;-) and it's still possible to implement `unsettable' variables (by appropriately implementing a setter function which does nothing, complains, whatever seems appropriate). I think it's even more flexible. Regards -- tomas _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel