[Top][All Lists]

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

Uninterned symbols

From: Marius Vollmer
Subject: Uninterned symbols
Date: 17 May 2001 00:50:30 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102

Martin Grabmueller <address@hidden> writes:

> > From: "Dale P. Smith" <address@hidden>
> >
> > BTW: gensym does not return unique symbols:
> > [...]
> > Wasn't this fixed a while back?  Or was that gentemp?
> Well, it was noticed a while ago, but AFAICT, nobody fixed it.  I
> wanted to wait for Marius vcell patch, which affected symbols as
> well.

Yeah, I wanted to fix it along the way, but I didn't since there were
some open questions.

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

They are easy to provide, but we should also think about printing and
reading uninterned symbols then.  I think it's OK to print uninterned
symbols somewhat specially (and readably) and use the mechanism for
printing shared structure to identify `eq' uninterned symbols.

(Incidentally, can `read' cope with shared structures?  It doesn't
look like it can.  Things like `#0#' conflict with the array syntax
since the hash extension don't deal with e general number prefix.  One
more thing to fix...)

What about using some variant of #{...}# to print uninterned symbols?
Would be people feel comfortable about changing it incompatibly?  Or
should we invent a new hash dispatch, like `#~unique'?  Or a new
syntax altogether?

(The uninternedness of a symbol can be flagged by one bit of its
hashing value).

reply via email to

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