guile-user
[Top][All Lists]
Advanced

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

Re: gensym


From: Dale P. Smith
Subject: Re: gensym
Date: Fri, 8 Sep 2000 16:27:07 -0400

"Dale P. Smith" wrote:
> 
> I don't thing gensym is right yet.
          ^^^^^ think
> 
> There are about a dozen or so places in calling.scm where gensym is used
> with a symbol, I thought recent changes required the first argument to
> be a string.  Trying it out, I find:

gensym is supposed to be called with a symbol, not a string.  It still
fails. Here is a patch that works, but there are probably better ways to
do it.

There are some places where gensym is called with a string:

address@hidden:~/src/guile/guile-core/ice-9$ grep 'gensym "' *.scm
boot-9.scm:  (gensym "scm:G"))
optargs.scm:    (let* ((kb-list-gensym (gensym "kb:G"))
optargs.scm:     (let ((rest-gensym (or rest-arg (gensym "lambda*:G"))))

And here it is called with a symbol:

address@hidden:~/src/guile/guile-core/ice-9$ grep "gensym '" *.scm
calling.scm:    (tmp-var-name (gensym 'temp))
calling.scm:    (swap-fn-name (gensym 'swap))
calling.scm:    (thunk-name (gensym 'thunk)))
calling.scm:  (let ((args-name (gensym 'args))
calling.scm:    (an-arg-name (gensym 'an-arg))
calling.scm:    (new-val-name (gensym 'new-value))
calling.scm:    (loop-name (gensym 'loop))
calling.scm:  (let ((args-name (gensym 'args))
calling.scm:    (an-arg-name (gensym 'an-arg))
calling.scm:    (new-val-name (gensym 'new-value))
calling.scm:    (loop-name (gensym 'loop))
oldprint.scm:(define (print-table-add! table obj) (hashq-set! table obj
(gensym 'ref)))

Here is the patch:
Index: symbols.c
===================================================================
RCS file: /cvs/guile/guile-core/libguile/symbols.c,v
retrieving revision 1.49
diff -c -r1.49 symbols.c
*** symbols.c   2000/09/06 14:45:59     1.49
--- symbols.c   2000/09/08 20:33:13
***************
*** 859,865 ****
    if (SCM_UNBNDP (name))
      name = gensym_prefix;
    else
!     SCM_VALIDATE_SYMBOL (1, name);
  
    new = name;
    if (SCM_UNBNDP (obarray))
--- 859,868 ----
    if (SCM_UNBNDP (name))
      name = gensym_prefix;
    else
!     {
!       SCM_VALIDATE_SYMBOL (1, name);
!        name = scm_symbol_to_string (name);
!     }
  
    new = name;
    if (SCM_UNBNDP (obarray))





-- 
Dale P. Smith
Altus Technologies Corp.
address@hidden
400-746-9000 x309


reply via email to

[Prev in Thread] Current Thread [Next in Thread]