unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* RFD: [PATCH] Fixing symbol printing
@ 2005-06-07 15:30 Andreas Rottmann
  2005-06-11 21:14 ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Rottmann @ 2005-06-07 15:30 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: guile-1.6-symbol-print.patch --]
[-- Type: text/x-patch, Size: 813 bytes --]

--- 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;

[-- Attachment #3: Type: text/plain, Size: 508 bytes --]


The patch is against 1.6, since I think that is a genuine bug in Guile
(being incompatible with R5RS).

Regards, Rotty
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
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?

[-- Attachment #4: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFD: [PATCH] Fixing symbol printing
  2005-06-07 15:30 RFD: [PATCH] Fixing symbol printing Andreas Rottmann
@ 2005-06-11 21:14 ` Marius Vollmer
  2005-06-11 23:40   ` Andreas Rottmann
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Vollmer @ 2005-06-11 21:14 UTC (permalink / raw)
  Cc: Guile Developers

Andreas Rottmann <a.rottmann@gmx.at> writes:

> Hi!
>
> I've developed the following patch, which fixes R5RS-compatibility for
> printing symbols starting/ending with ':'.


Good!

[...]

> 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.

Shouldn't we make a new printer option for this so that reading and
writing can be controlled separately?  The printer option could have a
setting that says "be compatible with the reader option", which would
be the default.

Ok?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFD: [PATCH] Fixing symbol printing
  2005-06-11 21:14 ` Marius Vollmer
@ 2005-06-11 23:40   ` Andreas Rottmann
  2005-09-04 21:32     ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Rottmann @ 2005-06-11 23:40 UTC (permalink / raw)


Marius Vollmer <mvo@zagadka.de> writes:

> Andreas Rottmann <a.rottmann@gmx.at> writes:
>
>> Hi!
>>
>> I've developed the following patch, which fixes R5RS-compatibility for
>> printing symbols starting/ending with ':'.
>
>
> Good!
>
> [...]
>
>> 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.
>
> Shouldn't we make a new printer option for this so that reading and
> writing can be controlled separately?  The printer option could have a
> setting that says "be compatible with the reader option", which would
> be the default.
>
> Ok?
>
Sounds good.

Rotty
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
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

I have a truly elegant proof of the  above, but it is too long to
fit into this .signature file.



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFD: [PATCH] Fixing symbol printing
  2005-06-11 23:40   ` Andreas Rottmann
@ 2005-09-04 21:32     ` Marius Vollmer
  0 siblings, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2005-09-04 21:32 UTC (permalink / raw)
  Cc: guile-devel

Andreas Rottmann <a.rottmann@gmx.at> writes:

>> Shouldn't we make a new printer option for this so that reading and
>> writing can be controlled separately?  The printer option could have a
>> setting that says "be compatible with the reader option", which would
>> be the default.
>>
>> Ok?
>>
> Sounds good.

Ok, I have done this now in HEAD.  (Still have to make my mind up
whether to do it also in 1.6...)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-04 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-07 15:30 RFD: [PATCH] Fixing symbol printing Andreas Rottmann
2005-06-11 21:14 ` Marius Vollmer
2005-06-11 23:40   ` Andreas Rottmann
2005-09-04 21:32     ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).