[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First cut at "curly-write" and "neoteric-write" with -shared and -cyclic versions



Beni Cherniavsky-Paskin <cben@xxxxxxxxxxxx> wrote:

> I'm getting some errors [guile 2.0.7]:

Thanks for the report!  I don't have guile 2.0.7 (yet); so this is a new problem to me.

...

> -#0=(quote . #0#)
> +'x

Hmm.. This report means that when (all) the writers were asked to
write out "(quote x)", they output:
  #0=(quote . #0#)

Instead of the correct:
  'x

Clearly the writers are getting it *completely* wrong.
What's weird is that the code works on older versions of guile, and it's based on
fairly well-tested code.  I'm also surprised the more complicated cases worked (!).

My guess is that there's a semantics issue with the hash table implementation.
If the hash table thought that the outer list and the symbol x were "eq?"... or used the
wrong equality operator so they'd be considered equal... then the code would do this.

Guile supports several hash table systems; I used the SRFI-69 hash tables because
they are especially portable.  But I did have to use a special declaration to get srfi-69
hash tables in guile without lots of spurious warnings.
Perhaps that special declaration no longer works in guile 2.0.7.

Can you replace the current lines:
  (use-modules ((srfi srfi-69)
               #:select ((make-hash-table . srfi-69-make-hash-table)
                         (hash-table? . srfi-69-hash-table?)
                         hash-table-set!
                         hash-table-update!/default
                         hash-table-ref
                         hash-table-ref/default
                         hash-table-walk
                         hash-table-delete! )))

with just:
  (use-modules (srfi srfi-69))

and try again with guile 2.0.7?
The guile 2 manual says that this is the correct way to import srfi-69:
http://www.gnu.org/software/guile/manual/html_node/SRFI_002d69.html#SRFI_002d69

--- David A. Wheeler