From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Todd Newsgroups: gmane.lisp.guile.devel Subject: Re: keyword cleanup patch Date: Sat, 10 Jan 2004 18:53:43 -0600 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <20040111005343.GA736@Richard-Todds-Computer.local> References: <20040108122518.GA19086@pazuzu> Reply-To: Richard Todd NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0108943962==" X-Trace: sea.gmane.org 1073782695 14060 80.91.224.253 (11 Jan 2004 00:58:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Jan 2004 00:58:15 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Jan 11 01:58:11 2004 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 1AfTve-000202-01 for ; Sun, 11 Jan 2004 01:58:11 +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 1AfUrS-0006in-KQ for guile-devel@m.gmane.org; Sat, 10 Jan 2004 20:57:54 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AfUr1-0006iF-P6 for guile-devel@gnu.org; Sat, 10 Jan 2004 20:57:27 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AfUqU-0006UV-5M for guile-devel@gnu.org; Sat, 10 Jan 2004 20:57:25 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AfUqT-0006T9-QO for guile-devel@gnu.org; Sat, 10 Jan 2004 20:56:53 -0500 Original-Received: from [66.171.157.203] (helo=Richard-Todds-Computer.local) by mx20.gnu.org with esmtp (Exim 4.24) id 1AfTrR-0001Cq-E8 for guile-devel@gnu.org; Sat, 10 Jan 2004 19:53:49 -0500 Original-Received: by Richard-Todds-Computer.local (Postfix, from userid 501) id B53EB83E1F; Sat, 10 Jan 2004 18:53:43 -0600 (CST) Original-To: Stephen Compall In-Reply-To: User-Agent: Mutt/1.4.1i 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:3192 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3192 --===============0108943962== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MW5yreqqjyrRcusr" Content-Disposition: inline --MW5yreqqjyrRcusr Content-Type: multipart/mixed; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 10, 2004 at 10:18:22AM -0600, Stephen Compall wrote: > Richard Todd writes: >=20 > > Why are both syntaxes allowed in this one area, anyway? I assume > > it's a historical reason? It's inconsistent with the rest of guile > > (AFAIK) where you have to set a reader option for this behavior. >=20 > On the syntax: Emacs Lisp uses plain `:' for keywords; other lisps may > do so as well. Incidentally, `#:' in front of a symbol in elisp will > prevent its interning. :) That doesn't explain why special code in boot-9 allows #: or : in specific statements like (define-module), does it? I may not be fully grasping what you are getting at. I've searched with google, and the only explanation I can find is that several guile developers prefer :. I'm fine with that sentiment, but guile's current state doesn't actually help these people, IMO. The main problem, as I see it, is that people can't use : in code they would release, because they can't assume that users are using the optional reader setting. Setting the option for the users would be disgusting, and potentially break their code. In my fledgling library of modules, I added a module which lets you do: (define-module (xxx) :use-syntax (guile-syntax colon-keyword)) =2E..and for this module you can code to your preference. Users need not even know about a reader extension (in fact, I took the extension itself out of my local guile tree, on principle!). To me, this is a sane answer. Plus, this approach can be extended to support 'keyword:' (as in DSSSL), or '&keyword', etc, without changing the scheme reader. Of course you take a speed hit compared to the reader option, but there are ways to help with that if it became an issue. (And though I may be alone, and have not done any research on this issue, I don't see why an elisp reader has to be grafted on to the scheme reader. Aside from the oh-so-close-to-scheme elisp case, if guile really wants to seamlessly support other languages, it needs a way to load a module with a different reader entirely, anyway. A separate elisp reader could still share code with the scheme reader, I would think, and would be a cleaner answer). The proof-of-concept (read: room for improvement!) module I described is attached, for any who might be interested. Richard Todd --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="colon-keyword.scm" Content-Transfer-Encoding: quoted-printable (define-module (guile-syntax colon-keyword) #:export (colon-keyword)) (define (colon-keyword exp) (let lp ((lst exp)) (cond=20 ((null? lst) exp) ((pair? lst) (set-car! lst (colon-keyword (car lst))) (if (pair? (cdr lst)) (lp (cdr lst)) (begin (set-cdr! lst (colon-keyword (cdr lst))) (lp '())))) ((symbol? lst) (let ((str (symbol->string lst))) (if (char=3D? (string-ref str 0) #\:) (symbol->keyword (string->symbol (substring str 1))) lst))) ((vector? lst) (let lp2 ((i 0)) (if (>=3D i (vector-length lst)) lst (begin (vector-set! lst i (colon-keyword (vector-ref lst i))) (lp2 (+ i 1)))))) (else lst)))) --3V7upXqbjpZ4EhLz-- --MW5yreqqjyrRcusr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (Darwin) iD8DBQFAAJ6Xa9lhNGIqsRIRAuetAJ4jULMld/V5MKbDDTwsDD8ofvtMPQCfTrSp WDcnIowvexIahL6w7UMxxS8= =9TYq -----END PGP SIGNATURE----- --MW5yreqqjyrRcusr-- --===============0108943962== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --===============0108943962==--