Re: [Scheme-reports] procedure identity Per Bothner (04 Jun 2013 23:20 UTC)
Re: [Scheme-reports] procedure identity Noah Lavine (05 Jun 2013 04:24 UTC)
Re: [Scheme-reports] procedure identity Per Bothner (05 Jun 2013 06:55 UTC)
Re: [Scheme-reports] procedure identity taylanbayirli@gmail.com (05 Jun 2013 10:40 UTC)
Re: [Scheme-reports] procedure identity Alaric Snell-Pym (05 Jun 2013 11:09 UTC)
Re: [Scheme-reports] procedure identity Andy Wingo (07 Jun 2013 21:23 UTC)
Re: [Scheme-reports] procedure identity Alaric Snell-Pym (07 Jun 2013 22:17 UTC)
Re: [Scheme-reports] procedure identity taylanbayirli@gmail.com (05 Jun 2013 11:18 UTC)
Re: [Scheme-reports] procedure identity John Cowan (05 Jun 2013 12:41 UTC)
Re: [Scheme-reports] procedure identity taylanbayirli@gmail.com (05 Jun 2013 14:02 UTC)

Re: [Scheme-reports] procedure identity Per Bothner 05 Jun 2013 06:54 UTC

On 06/04/2013 09:23 PM, Noah Lavine wrote:
> As I'm sure you're aware, there is a strong correspondence between
> procedures and records. Closures can be implemented as records holding
> state variables and code, and records can be implemented as special
> procedures. It would make sense to me that the rules for procedures and
> records would be the same. So it would be convenient if the result of
>
> (eq? (lambda (x) x) (lambda (x) x))

Note my example is different: It was the *same* identical
lambda expression being evaluated multiple times:

(define (maybe-negate negp)
    (if negp (lambda (x) (- x))
        (lambda (x) x)))

In that case a very natural (and desirable) optimization
is to re-write this to:

(define $lambda1$ (lambda (x) (- x)))
(define $lambda2$ (lambda (x) x))
(define (maybe-negate negp)
    (if negp $lambda1$
        $lambda2$))

> were the same as
>
> (define-record-type my-record make-my-record my-record?)
>
> (eq? (make-my-record) (make-my-record))
>
> It makes the most sense to me if both of these expressions return #f.

It may make sense, but if the specification prohibits the optimization
above then IMO it's wrong.

The problem is if you allow the optimization, then it becomes
difficult to specify when a "location tag" is created.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports