[plt-scheme] Procedure equality

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Apr 30 08:26:22 EDT 2009

At Thu, 30 Apr 2009 15:01:35 +0300, Abdulaziz Ghuloum wrote:
> 
> On Apr 30, 2009, at 2:52 PM, Robby Findler wrote:
> 
> > I think that, in principle, compiler optimizations can get in the way
> > of that working properly, but as far as I know, it will only make more
> > things eq? not fewer (as compared to what you might think).
> 
> It can go both ways.
> 
> For example, the expression
> 
>    (let ([foo (lambda () 42)])
>      (eq? foo foo))
> 
> might be transformed after copy propagation to
> 
>    (eq? (lambda () 42) (lambda () 42))
> 
> and this expression may evaluate to #f.
> 
> The same nonguarantee applies to numbers (afaik).  For example
> 
>    (let ([x 1.0]) (eq? x x))
> 
> may return #f.

This is correct for many dialects of Scheme, including standard
dialects. But in PLT Scheme, `(let ([x <expr>]) (eq? x x))' produces #t
for any `<expr>'.




Posted on the users mailing list.