bug-guile
[Top][All Lists]
Advanced

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

Re: Uninterned symbols


From: Dirk Herrmann
Subject: Re: Uninterned symbols
Date: Thu, 17 May 2001 17:10:34 +0200 (MEST)

On 17 May 2001, Marius Vollmer wrote:

> Martin Grabmueller <address@hidden> writes:
> 
> > The problem is that I can not imagine a way to safely create unique
> > symbols, since the only functions left for creating symbols are
> > 
> >   extern SCM scm_mem2symbol (const char*, scm_sizet);
> >   extern SCM scm_str2symbol (const char*);
> > 
> > which both enter the symbol into the global symbol hash table.  So it
> > is always possible to create symbols (i.e. with string->symbol) eq? to
> > symbols returned by gensym.  Can anyone else think of a solution here?
> 
> The canonical solution is to have uninterned symbols, i.e. symbols
> that are not in the global hash table.

Maybe I am too blind to see, but:  What are the problems with providing
unique symbols?  We have one single hash table in guile, thus it should be
possible to determine whether a symbol exists or not.  Using some prefix
(say, 'gensym-') an an incrementally increased number as postfix, it
should be possible to come quickly to a symbol that has never been used
before.  In the context of threads, you would have to lock the symbol
table during the search for a new symbol.

All other suggestions seem strange to me:  Why add the concept of
uninterned symbols?  How can two uninterned symbols be eq?, how do you
print them uniquely (seems impossible:  with string->symbol you should be
able to create any interned symbol you like and make it look like an
uninterened one.), and if you want to be able to read the same uninterened
symbols twice, you will at some time want to make sure that you get an
uninterned symbol that was never unsed before, which leads us to
un^2interned symbols, which leads us to un^3interned symbols etc.

Am I misunderstanding something?

Best regards,
Dirk Herrmann




reply via email to

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