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

Re: propositions, oppositions, and some minor details

This page is part of the web mail archives of SRFI 57 from before July 7th, 2015. The new archives for SRFI 57 contain all messages, not just those from before July 7th, 2015.

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

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