From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: New syntax: (: MODULE-NAME VARIABLE-NAME) Date: Sat, 15 Nov 2003 16:19:39 +0100 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <874qx5slpw.fsf@zagadka.ping.de> References: <87brrgw32m.fsf@zagadka.ping.de> <873ccsugrz.fsf@zagadka.ping.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068909892 22304 80.91.224.253 (15 Nov 2003 15:24:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2003 15:24:52 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Nov 15 16:24:49 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AL2I5-0000Lh-00 for ; Sat, 15 Nov 2003 16:24:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AL3Bs-0003tU-NE for guile-devel@m.gmane.org; Sat, 15 Nov 2003 11:22:28 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AL3B7-0003jj-0f for guile-devel@gnu.org; Sat, 15 Nov 2003 11:21:41 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AL3AZ-0003Wy-12 for guile-devel@gnu.org; Sat, 15 Nov 2003 11:21:38 -0500 Original-Received: from [195.253.8.218] (helo=mail.dokom.net) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AL3AY-0003Wd-9l for guile-devel@gnu.org; Sat, 15 Nov 2003 11:21:06 -0500 Original-Received: from dialin.speedway15.dip103.dokom.de ([195.253.15.103] helo=zagadka.ping.de) by mail.dokom.net with smtp (Exim 3.36 #3) id 1AL2Fr-0000fA-00 for guile-devel@gnu.org; Sat, 15 Nov 2003 16:22:31 +0100 Original-Received: (qmail 8391 invoked by uid 1000); 15 Nov 2003 15:19:39 -0000 Original-To: Neil Jerram In-Reply-To: (Neil Jerram's message of "14 Nov 2003 21:04:36 +0000") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 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:3029 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3029 Neil Jerram writes: > OK. One other specification query: will `:' only work if the relevant > binding is exported? Yes, I think that's more disciplined. Here is the actual code: ;; The following macro allows one to write, for example, ;; ;; (: (ice-9 pretty-print) pretty-print) ;; ;; to refer directly to the pretty-print variable in module (ice-9 ;; pretty-print). It works by looking up the variable and inserting ;; it directly into the code. This is understood by the evaluator. ;; Indeed, all references to global variables are memoized into such ;; variable objects. (define-macro (: mod-name var-name) (let ((var (module-variable (resolve-interface mod-name) var-name))) (if (not var) (error "no such public variable" (list ': mod-name var-name))) var)) -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel