Hi,
I'm a bit confused about the purpose of passing accessors names via fieldspec.
The SRFI says fieldspec argument of make-record-type-descriptor should contain
accessor and mutator, and I can read that these must be procedures (or #f if
mutator is absent). However, there's no procedure which can make either
accessor or mutator in the SRFI. Plus, the test passing symbols for this.
Here comes my questions:
- Are these must be procedure?
- If this can be symbols, then what's the purpose of passing names?
If it's debugging purpose, then I think it's not really relevant since users
can bind the procedures to names whatever they want to.
If it's indicating mutability of the field, then, I think, 2 elements of list
(field-name boolean) would be simpler.
- If this must be procedures, then how can I create them?
They are just symbols. So you are right in that the names passed are irrelevant. They just indicate mutability as you have guessed.
I agree that this is not optimal. I suggest to change the protocol to the one specified in SRFI-99 (except for that I would continue to use a list of field specifiers, not a vector):
fieldspecs is a vector of field specifiers, where each field specifier is one of
- a symbol naming the (mutable) field;
- a symbol naming the (mutable) field;
- a list of the form
(mutable name)
, where name is a symbol naming the mutable field; - a list of the form
(immutable name)
, where name is a symbol naming the immutable field.
What do you think?