[R6RS] Record protocol identity functions
Anton van Straaten
anton at appsolutions.com
Thu Jun 15 18:25:19 EDT 2006
In the Records documentation for make-record-constructor-descriptor, I'm
wondering about the following:
> In the first case, 'protocol' will default to a procedure equivalent
> to the following:
> (lambda (p)
> (lambda field-values
> (apply p field-values)))
Wouldn't it be sufficient to write something like "In the first case,
'protocol' will default to a procedure equivalent to the identity
function, (lambda (p) p)" ?
Of course, the latter procedure won't check that p is a procedure, but
since p is supplied by the record mechanism, that shouldn't be necessary.
On a related note, the first protocol example:
(lambda (new) (lambda (v ...) (new v ...)))
...could also be replaced by (lambda (new) new), assuming that the
ellipses don't hide anything funky. In this case, I suppose the
expanded version provides a clearer hint as to the possibilities
afforded by the protocol.
More information about the R6RS