Re: [Scheme-reports] Seeking review of sets and hash tables proposals taylanbayirli@gmail.com (25 May 2013 14:25 UTC)
Re: [Scheme-reports] Seeking review of sets and hash tables proposals John Cowan (26 May 2013 14:46 UTC)

Re: [Scheme-reports] Seeking review of sets and hash tables proposals John Cowan 26 May 2013 14:45 UTC

Taylan Ulrich B. scripsit:

> > ;; 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)

Quite right, certainly at the REPL.  In a library, this can't happen,
because it's an error to mutate an imported identifier.

> 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.

That's an open question.  In general, lexical syntax may or may not
be hygienic.  #(...) is, in the sense that if you interpret #(foo bar)
unofficially as (vector 'foo 'bar), this uses the binding of `vector`
in the base library.  On the other hand, ' is not hygienic at all:
(let ((quote -)) '32) evaluates to -32, not 32, and this is true even
in hygiene-fanatical Racket.

> 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.

There's no possible ambiguity there:  `case` is a hygienic macro, and
so it uses the definition of `eqv?` bound in the base library, where
`case` itself is bound.

--
John Cowan  cowan@ccil.org  http://www.ccil.org/~cowan
Does anybody want any flotsam? / I've gotsam.
Does anybody want any jetsam? / I can getsam.
        --Ogden Nash, No Doctors Today, Thank You

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