[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Seeking review of sets and hash tables proposals



Daniel Hartwig <mandyke@x> writes:

> More special casing which is undesirable and makes specifications
> harder to follow.  Anyway, that is still problematic as in this
> pathological example:
>
> ;; #setv(x ...) is a literal form of ‘(set eqv? x ...)’
> (define foo #setv(0 1 2))
> (define bar (set eqv? 0 1 2))
> (set=? foo bar) => #t ; presumably, although foo is immutable by
> virtue of being a literal
> (display bar) => #setv(0 1 2)
>
> ;; Somewhere along the line, ‘eqv?’ changes …
> (define eqv? (lambda (a b) (not (equal? a b))))
> ;; … but noone told me!
> (define quaz (set eqv? 0 1 2))
> (set=? foo quaz) => #f ; expecting #t
> (display quaz) => ?? ; unspecified, expecting #setv(0 1 2)
>
>
> When dealing with an arbitrary set you dont know whether it has the
> printed representation of blessed sets or the “other” representation.
>
> _______________________________________________
> Scheme-reports mailing list
> Scheme-reports@x
> http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

I fail to understand the problem in the example.  Should the programmer
not be always aware of any re-binding of `eqv?', regardless of what its
default binding happens to be?  Indeed, the specification could say that
#setv sets use "the procedure bound to the identifier `eqv?' in the
default environment" or so, or it could just spell out the semantics of
eqv?  without mentioning the identifier `eqv?', etc., but in no case
should it actually depend on that identifier's binding at any time.

Indeed, looking at draft 9, I see it refer to "eqv?" in the definition
of `case'.  That seems to be an analogous case to this one; no mention
of an "identifier" is made, and in my opinion it's relatively clear that
the intended meaning is the procedure known as "eqv?" regardless of what
identifier it's bound to at any time, and regardless of any binding for
the identifier `eqv?' at any time.

(I hope I could make myself clear.)

Taylan

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