This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: gensym
- To: guile-user at gnu dot org, bug-guile at gnu dot org
- Subject: Re: gensym
- From: "Dale P. Smith" <dpsm at en dot com>
- Date: Fri, 8 Sep 2000 16:27:07 -0400
- List-Id: <guile-user.gnu.org>
- Organization: Altus Technologies Corporation.
- References: <39B794DC.9861ADE7@en.com>
"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:
dsmith@sammy:~/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:
dsmith@sammy:~/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.
dsmith@altustech.com
400-746-9000 x309
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user