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

Re: A different approach

This page is part of the web mail archives of SRFI 75 from before July 7th, 2015. The new archives for SRFI 75 contain all messages, not just those from before July 7th, 2015.



On 7/19/05, Jens Axel Søgaard <jensaxel@xxxxxxxxxxxx> wrote:
> felix winkelmann wrote:
> 
> > Uninterned symbols are (currently) not provided by standard Scheme,
> > and can be simulated by some magic prefix in portable code.
> 
> Nevertheless, the section eqv? has the following note on symbols:
> 
>    The eqv? procedure returns #t if:
> 
>      * obj1 and obj2 are both symbols and
> 
>        (string=? (symbol->string obj1)
>                  (symbol->string obj2))
>                    ===>  #t
> 
>            Note:   This assumes that neither obj1 nor obj2 is an
>    ``uninterned symbol'' as alluded to in section 6.3.3. This report does
>    not presume to specify the behavior of eqv? on
>    implementation-dependent extensions.

Hey, another little piece of R5RS that I didn't know...

> 
> Since some implementation do have uninterned symbols, it implies
> that it isn't great style to rely on the above.
> 

Well, I'm usually very careful with broad "isn't great style"
generalisations. Uninterned
symbols do in fact complicate the (IMHO rather handy) assumption that
symbol->string and string->symbol 1:1 relationship. Gensyms are an
implementation
hack (used in 99% of all cases for "defmacro"-style macro programming). In fact,
I'd rather see a "(genguid)" than a "(gensym)" :-).

The problem is that I've seen numerous bodies of code (object-systems,
macro-expanders,
module systems, ...) that depend on some kind of "symbol-append" function and
convert back and forth between symbols and strings. In these cases a
1:1 relationship
is required as uninterned symbols may lead to unexpected things.


cheers,
felix