[r6rs-discuss] [Formal] Add symbol=? and boolean=?

From: Per Bothner <per>
Date: Sat Feb 10 22:55:52 2007

Aubrey Jaffer wrote:
> | Date: Sat, 10 Feb 2007 09:30:36 -0800
> | From: Per Bothner <per_at_bothner.com>
> | One could argue that eq? tests for "object identity". However,
> | (one could also argue) that booleans, symbols, and numbers are
> | immutable values, not objects, and so object identity is a
> | meaningless concept. The reason we have eq? defined on symbols and
> | boolean (not it is not defined on numbers) is because Scheme has
> | rather mushy semantics when it comes to values versus objects.
>
> To my thinking this puts the cart before the horse. The purpose of
> symbols is to give us named objects which are EQ?.

No, that's just an optimization. In Common Lisp symbols have
"cells" and "property lists", so the concept of symbol identity
has some semantic purpose. While of course Scheme wouldn't be
Scheme if equal symbols weren't eq? it wouldn't affect the
"power" of the language much if any. You can think of a symbol as a
hash-consed object with a single string field. But there is
no reason why you can't have hash-consed immutable strings or
lists or vectors as well, and some language/implementations do that.
-- 
	--Per Bothner
per_at_bothner.com   http://per.bothner.com/
Received on Sat Feb 10 2007 - 22:57:05 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC