[R6RS] Record proposal syntax simplification

Anton van Straaten anton
Fri Aug 19 15:57:26 EDT 2005


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

I am happier with this than with the longer keywords.

I don't like that the two-element grouping (x get-x) changes to a 
four-element one, (! x get-x set-x!), in the mutable case.  I think it 
would be easier to remember the syntax if there were more symmetry 
between the cases, which was something I was going for in my syntax.

However, that's addressed to some extent by this:

> How about:
> 
>    (<spec> init)
>    (! <spec!> init)
> 
> where
> 
>    <spec> -> <id> | (<id> <accessor>)
>    <spec!> -> <id> | (<id> <accessor> <mutator>)

So the earlier examples would become:

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

That's a bit better, IMO.  I still find the injection of ! to be 
slightly off-putting, and since convention dictates that mutator names 
contain bangs anyway, it doesn't seem necessary to me.  However, I could 
live with it.

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

If init expressions are made optional in this way even in the explicit 
naming layer, then combined with the syntax defined above, I'd be pretty 
happy with the proposal.

Anton



More information about the R6RS mailing list