(Previous discussion continued)
Re: propositions, oppositions, and some minor details Andre van Tonder 15 Sep 2004 12:53 UTC

Re: propositions, oppositions, and some minor details Andre van Tonder 15 Sep 2004 12:53 UTC

On Tue, 14 Sep 2004, Alex Shinn wrote:

> At Tue, 14 Sep 2004 19:42:18 -0400 (EDT), Andre van Tonder wrote:

> But there's never any need for that many #f's, since you can just omit
> them:
>
>  (define-record-type point2 #f #f (x) (y))
>
> Except in the pathological case of providing setters but no getters
> you will have at most two #f's, for constructor and predicate, and it
> doesn't seem worthwhile to introduce a keyword just to avoid that.

Except that I was thinking of using the arity to determine whether the
field was mutable or not (even in the absence of setters, thge
distinction is important for update!).
We do have to distinguish, since mutable and immutable fields may be
implemented differently, as in the reference implementation where mutables
are boxed.  So

   (define-record-type point #f #f (x #f)    (y #f))       - immutable
   (define-record-type point #f #f (x #f #f) (y #f #f))    - mutable

It has occurred to me that it might be worthwhile, and hopefully not too
confusing, to provide the following shortcuts for the above two cases

   (define-record-type point #f #f  x   y)     - immutable
   (define-record-type point #f #f (x) (y))    - mutable

In fact, I think I like this a lot, since you can even see the "boxes"
around the fields...

Andre