[R6RS] Record proposal syntax simplification

dyb at cs.indiana.edu dyb
Sat Aug 13 14:05:47 EDT 2005

> It could be argued that the presence of these keywords make the 
> mutability status of a field more explicit to the reader of the code. 

Yes, I would argue that.

> However, the keywords have a low signal-to-noise ratio, since they 
> communicate only a single bit of information that's already present in 
> another form.  They also tend to obscure more important information,
> ...

True.  Since it's only a single bit of information, we could use ! instead
of immutable and nothing in place of mutable.

   ((! x get-x set-x!) init)
   ((x get-x) init)

The ! won't obscure much.

>    Current syntax          Modified syntax
>    --------------          ---------------
>    ((mutable x) x)         (x mutable x)
>    ((immutable y) y)       (y immutable y)
> The modified syntax is a little cleaner, and again, the field name 
> appears at the beginning of the expression.

The "current" syntax seems cleaner to me.  In the modified syntax it
looks like the expression is being marked mutable or immutable rather
than the field.  Generally, I'd prefer that modifiers (mutability,
type, etc.) come before the field name.

How about:

   (<spec> init)
   (! <spec!> init)


   <spec> -> <id> | (<id> <accessor>)
   <spec!> -> <id> | (<id> <accessor> <mutator>)

> 3. Optional init expressions
> ----------------------------

> In the case where a field without an init expression also has no 
> corresponding formal with the same name, my preference is to make this 
> an error. This will force all fields to be properly initialized, either 
> explicitly via an init expression, or implicitly via the constructor 
> arguments.

I agree.


More information about the R6RS mailing list