[Top][All Lists]

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

Re: Uninterned symbols

From: Martin Grabmueller
Subject: Re: Uninterned symbols
Date: Thu, 17 May 2001 21:26:11 +0200

> From: Dirk Herrmann <address@hidden>
> Date: Thu, 17 May 2001 17:10:34 +0200 (MEST)
> 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.

Writing gensym the way you propose makes it possible to create symbols
which are unique as far as the already existing symbols are concerned.
But what about symbols which are created after gensym'ing a symbol?
Consider this (old behaviour):

guile> (define s (gensym))
guile> s
guile> (eq? s (string->symbol "g0"))

With my patch, the symbol made by string->symbol will not be eq? to
the gensym'ed one, even though it looks the same.

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

Well, that's right.  It is of course not possible to create ``forever
uninterned'' symbols.  But on the other hand, I think it should be
possible to create symbols which could not possible clash with normal
symbols, for example for writing macros or translators.

So maybe we should dump printing/reading of uninterned symbols, but
keep them for gensym?

> Am I misunderstanding something?

Could as well be me ;-)


reply via email to

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