From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.user Subject: Keyword syntax Date: Mon, 04 Oct 2004 20:27:44 +0200 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1096914499 20667 80.91.229.6 (4 Oct 2004 18:28:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 4 Oct 2004 18:28:19 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Oct 04 20:28:07 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 1CEXZ8-0000Yo-00 for ; Mon, 04 Oct 2004 20:28:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CEXfk-00055q-2H for guile-user@m.gmane.org; Mon, 04 Oct 2004 14:34:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CEXfg-00055b-Fw for guile-user@gnu.org; Mon, 04 Oct 2004 14:34:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CEXff-000555-GZ for guile-user@gnu.org; Mon, 04 Oct 2004 14:34:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CEXff-00054u-Bc for guile-user@gnu.org; Mon, 04 Oct 2004 14:34:51 -0400 Original-Received: from [129.217.163.1] (helo=mail.dt.e-technik.uni-dortmund.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CEXYo-0002g0-2b for guile-user@gnu.org; Mon, 04 Oct 2004 14:27:46 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.dt.e-technik.uni-dortmund.de (Postfix) with ESMTP id 593EF41EE0 for ; Mon, 4 Oct 2004 20:27:45 +0200 (CEST) Original-Received: from mail.dt.e-technik.uni-dortmund.de ([127.0.0.1]) by localhost (krusty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15930-03 for ; Mon, 4 Oct 2004 20:27:45 +0200 (CEST) Original-Received: from troy.dt.e-technik.uni-dortmund.de (troy.dt.e-technik.uni-dortmund.de [129.217.163.17]) by mail.dt.e-technik.uni-dortmund.de (Postfix) with ESMTP id 3ACEF41EA5 for ; Mon, 4 Oct 2004 20:27:45 +0200 (CEST) Original-Received: by troy.dt.e-technik.uni-dortmund.de (Postfix, from userid 520) id A14A6B992; Mon, 4 Oct 2004 20:27:44 +0200 (CEST) Original-To: guile-user@gnu.org User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) X-Virus-Scanned: by amavisd-new at dt.e-technik.uni-dortmund.de X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:3505 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:3505 Hi, I'm considering to change keywords are read or written by Guile, to make the two operations more consistent with each other. Right now, keywords are read as a single token and a part of that token is made the keyword name, which is a symbol. For example, a token can be "#:foo" (without the double quotes) and the name of the keyword is the symbol named "foo". Also, "#:12" gives a keyword with a symbol as the name that itself has the name "12". Now, "12" is not a valid way to write this symbol in Scheme, and there for Guile writes the keyword #:12 in the following funny way: guile> #:12 #:#{12}# The "#{12}#" is the syntax to write a symbol with an arbitrary name. However, reading this printed form gives a different keyword. guile> #:#{12}# #:#{\#{12}\#}# I can see two ways to fix this: 1) changing the way keywords are read and 2) changing the way they are printed. As to 1), the simplest change would be to just do the equivalent of (symbol->keyword (read port)). Thus, the name of a keyword is read as a general Scheme datum, and is then validated to be a symbol and converted to a keyword. For 2), we would have to print keyword without using the symbol printer and would have to explicitely deal with 'weird' keyword names ourselves. I have implemented 1) in CVS head as an experiment. Below is a sample session, showing the differences. I like 1) more than 2) (by a small margin) although it is a more radical change since keywords right now are defined to have symbols as names anyway and because it is equivalent to doing (read-hash-extend #\: (lambda (chr port) (symbol->keyword (read port)))) which I like because it is very straightforward. Previously guile> #:12 #:#{12}# guile> #:#{12}# #:#{\#{12}\#}# guile> #:(a b c) #:#{}# ERROR: In expression (a b c): Unbound variable: a guile> #: foo #:#{}# ERROR: Unbound variable: foo With 1) guile> #:12 ERROR: Wrong type (expecting symbol): 12 guile> #:#{12}# #:#{12}# guile> #:(a b c) ERROR: Wrong type (expecting symbol): (a b c) guile> #: foo #:foo Opinions? _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user