Ray Dillinger (single >) quoting me (>>) quoting John Cowan (>>>):

>>> I'm probably missing something here, but if h doesn't need a
>>> closure, what's wrong with using the code address as a unique
>>> tag?

>> Because that would violate both R5RS and R6RS semantics.

>> Both the R5RS and R6RS insist that procedures that are eqv? behave
>> the same.  Distinct procedures that share the same code are
>> unlikely to behave the same.

> Um?  Will, did you misspeak here or is there something very
> fundamental that I'm not understanding?  As I see it the same
> vector of code ought to produce the same behavior when run.

I did not misspeak.  Jeff Read explained my meaning.

Here's a concrete example:

(define (make-counter)
  (let ((n 0))
    (lambda () (set! n (+ n 1)) n)))

(define f (make-counter))

(define g (make-counter))

The values of f and g are procedures.  Those procedures are likely
to be represented by closures that share the same code vector.
With John Cowan's suggested implementation of eqv?, (eqv? f g)
would return true, which would violate both R5RS and R6RS semantics.

> Different nonempty closures over the same procedure are unique,
> of course, but the procedure itself?

A closure is a representation of a procedure.  In the various
Scheme mailing lists, most uses of the word "closure" should
really be uses of the word "procedure" instead.

Will

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to