A different approach
Thomas Lord
(18 Jul 2005 17:45 UTC)
|
Re: A different approach
felix winkelmann
(19 Jul 2005 08:19 UTC)
|
Re: A different approach
Jens Axel Søgaard
(19 Jul 2005 08:29 UTC)
|
Re: A different approach
felix winkelmann
(19 Jul 2005 08:39 UTC)
|
Re: A different approach
Jens Axel Søgaard
(19 Jul 2005 08:46 UTC)
|
Re: A different approach felix winkelmann (20 Jul 2005 07:25 UTC)
|
Re: A different approach
Jens Axel Søgaard
(20 Jul 2005 10:07 UTC)
|
Re: A different approach felix winkelmann 20 Jul 2005 07:25 UTC
On 7/19/05, Jens Axel Søgaard <xxxxxx@soegaard.net> 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