Hi!

I've developed the following patch, which fixes R5RS-compatibility for
printing symbols starting/ending with ':'. The problem with the
current behaviour is that you end-up with files that can not be read
from other Schemes when you write out such symbols:

guile> (write ':foo) (newline)
#{:foo}#
guile>

My patch changes this behaviour to what you'd expect:

guile> (write ':foo) (newline)
:foo
guile>

However, when the keywords reader option is set, the old behaviour is
re-established, to allow writing out these symbols in "escaped form"
so that they can be read back when the prefix keywords reader option
is turned on.

--- guile-1.6.7/libguile/print.c	2003-04-20 20:16:40.000000000 +0200
+++ guile-1.6-1.6.7.mod/libguile/print.c	2005-05-29 18:38:31.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999,2000,2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999,2000,2001, 2003, 2005 Free Software Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -324,7 +324,9 @@
 
   if (len == 0)
     scm_lfwrite ("#{}#", 4, port);
-  else if (str[0] == '#' || str[0] == ':' || str[len-1] == ':')
+  else if (str[0] == '#'
+           || (SCM_NFALSEP (SCM_PACK (SCM_KEYWORD_STYLE))
+               && (str[0] == ':' || str[len-1] == ':')))
     {
       scm_lfwrite ("#{", 2, port);
       weird = 1;
The patch is against 1.6, since I think that is a genuine bug in Guile
(being incompatible with R5RS).

Regards, Rotty
-- 
Andreas Rottmann         | [EMAIL PROTECTED]      | [EMAIL PROTECTED] | [EMAIL 
PROTECTED]
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62
v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com

A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

Reply via email to