[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Procedural equivalence: the last debate
- To: will@x
- Subject: Re: [Scheme-reports] Procedural equivalence: the last debate
- From: John Cowan <cowan@x>
- Date: Tue, 4 Jun 2013 15:03:45 -0400
- Cc: scheme-reports@x
- In-reply-to: <15670151.2289411370361012620.JavaMail.root@zimbra>
- References: <6396504.2289381370360900956.JavaMail.root@zimbra> <15670151.2289411370361012620.JavaMail.root@zimbra>
will@x scripsit:
> 1. Retain the notion of location tags for procedures, which are
> allocated and attached to procedures when lambda expressions are
> evaluated.
True in R5RS, false in R6RS.
> 2. Require eqv? to return #t when its arguments are procedures that
> have the same location tag.
True in R5RS, false in R6RS.
> 3. Require eqv? to return #f when its arguments are procedures that
> would behave differently for some arguments.
True in both R5RS and R6RS.
> 4. If eqv? returns #f when given procedures p1 and p2 as arguments,
> then eq? must also return #f when given procedures p1 and p2 as
> arguments.
That is a natural extension of the contract of `eq?` on numbers and
characters.
> 5. If eqv? returns #t when given procedures p1 and p2 as arguments,
> then eq? may return #t or may return #f when given procedures p1 and
> p2 as arguments.
This is the essence of the change from R5RS you are proposing.
> Although John Cowan has claimed otherwise, I believe part 5 is also
> consistent with the R4RS/R5RS/IEEE semantics of eq? and eqv? (modulo
> two examples). Here's what John Cowan wrote:
>
> In all reports, `eq?` is the same as `eqv?` except on numbers and
> characters.
I claim that *because* of the two examples.
> I may be missing something, but I suspect that the widespread belief
> that the R5RS requires eq? and eqv? to behave the same is based at
> least in part on the following examples given for eq?:
>
> (eq? car car) ==> #t
> (let ((p (lambda (x) x)))
> (eq? p p)) ==> #t
>
> Note, however, that those two examples do not actually require eq? and
> eqv? to behave the same whenever their arguments are procedures.
Can you explain why not? The only idea I can come up with is that the
examples are not really exemplary, that they apply only to the cases of
procedures that don't close over anything.
> The *only* disadvantage of my proposal is that programmers who want to
> realize the advantages of the R5RS semantics as listed originally by
> Alex Shinn and repeated by John Cowan would have to be careful to use
> eqv? when comparing procedures instead of using eq?.
My view of `eq?` is the same as the supposed view of the Muslim general
conquering the city of Alexandria, that all the books in the famous
Library were either redundant to the Quran or refuted by it. When it
is safe to use `eq?`, it is just as good to use `eqv?`, and when it is
unsafe -- well, it's unsafe.
> I have already explained this proposal to G J Sussman, who said he
> would be okay with it. He may express a different or more detailed
> opinion if he joins this discussion, and I hope he does.
I hope so too.
--
Kill Gorgun! Kill orc-folk! John Cowan
No other words please Wild Men. cowan@x
Drive away bad air and darkness http://www.ccil.org/~cowan
with bright iron! --Ghan-buri-Ghan http://www.ccil.org/~cowan
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports