Sample implementation Lars Thomas Hansen (17 Jan 2000 14:27 UTC)
Re: Sample implementation Matthias Felleisen (17 Jan 2000 14:39 UTC)
Re: Sample implementation Per Bothner (17 Jan 2000 19:44 UTC)
Re: Sample implementation Lars Thomas Hansen (17 Jan 2000 20:53 UTC)
a meta-comment Per Bothner (17 Jan 2000 20:00 UTC)
Re: a meta-comment Lars Thomas Hansen (17 Jan 2000 21:14 UTC)

Re: Sample implementation Per Bothner 17 Jan 2000 19:44 UTC

Lars Thomas Hansen <xxxxxx@ccs.neu.edu> writes:

> I hacked up a sample implementation that, as far as I can tell, covers
> the entire specification (Alternative 1 because I'm lazy).

Thanks!  That looks pretty good.  Two nits:

> (define-syntax set! let*
>   (syntax-rules ()
>     ((set! (?e0 ?e1 ...) ?v)
>      ((setter ?e0) ?e1 ... ?v))
>     ((set! ?i ?v)
>      (set! ?i ?v))))

Why the question-marks?  It makes it look like they have
some syntactic signifigance, but it is really just a
naming convention.  Is it a common naming convention?
I haven't really it noticed before.  To me (who have done
my of my programing in C/C++/Java), the question marks are
visually distracting.

>              (set-setter!
>               (lambda (proc setter)
>                 (set! setters (cons (cons proc setter) setters))
>                 (unspecified))))

Some implementors may just use the sample implementation,
though that is of course a bad idea for code that actually
uses setters heavily.  We could at least make sure that the
setters list doesn't fill up with duplicates.  (I realize I did
propose that changing a setter should be undefined, in which
case the concern duplicates is irrelevant.  However, you yourself
suggested that we should allow setters to be redefined.)

             (set-setter!
              (lambda (proc setter)
                (let ((probe (assq proc setters)))
                  (if probe
                    (set-cdr! probe setter)
                  (set! setters (cons (cons proc setter) setters))))
                (unspecified))))

--
	--Per Bothner
xxxxxx@bothner.com   http://www.bothner.com/~per/