This exchange fell off the list accidentally:

On Thu, Sep 17, 2015 at 8:58 PM, Anthony Carrico <acarr...@memebeam.org>
wrote:
> On 09/17/2015 09:27 PM, Robby Findler wrote:
>> eq? on symbols is a special part of the specification and that seems
>> benign to me, all things considered. The "giant hash in the sky" that
>> makes sure that works isn't exactly trouble free, but we seem to have
>> it under control.
>
> Isn't eq? baked into the language already? Check-not-eq?, canonical
> objects (symbols are a special case of that), and weak tables are three
> places that the language is telling us we really /do/ learn something
> when eq? returns #f. I do understand why you would want deemphasize eq?,
> but I don't think you can get away with a just warning.

No, you're not learning something, even in that case. Well, I suppose
you might say that you're learning it didn't return #t, but what that
really means is "try harder". I consider check-eq? and friends a
mistake, symbols I've already mentioned and eq hash table are really
just a fancier form of eq? (so if I'm being careful I should include
them).

Really what I'm trying to say is that the language implementation
wants the freedom to adjust your program without having to be
constrained by eq tests that you might do. One example of this is
contracts. I might wish to be accept a function you give me, put a
contract on it, and give it back to you. This shouldn't really be
detectable if the contract doesn't fail. But it is, because of eq?.
Similarly, a compiler might want to change around exactly when it
allocates those cons cells (doing more sharing sometimes to reduce
memory footprint) but it can't because this is detectable via eq?, so
it isn't a behavior preserving transformation.

> As an example, I'm writing a toy sets-of-scopes expander. Scopes could
> be Natural, or whatever, but I'm wrapping them in a struct so I can use
> them to key weak tables. I can see other some other kind of language
> support as a replacement, like an Identity type, or some kind of Graph
> type where nodes not connected to a root are garbage (making local that
> formerly global feature of the heap).

I think weak tables are a separate issue. You mean eq tables, right?

And if so, you could have used a natural in a field and then used
equal? on that natural to get the same behavior, right? Then I can
decide to increment the natural when I want to and have precise
control over which ones are considered equal and which aren't. (I
agree this is not as convenient and, as I wrote earlier, alas, if i
were serious in fixing this, I would make that stuff more convenient.)

-- 
Anthony Carrico

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to