Re: Possible SRFI: Minimal record introspection
Marc Nieper-WiÃkirchen 05 Jul 2020 20:50 UTC
Am So., 5. Juli 2020 um 21:54 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
> I've been thinking about a SRFI that contains just what a user needs for record introspection, a tiny subset of SRFI 99. I think the bare minimum for pattern matching is:
> Comments?
The problem is that your proposal seems to be based on SRFI 99 but
SRFI 99 is not compatible with the R7RS-small interpretation of field
names being identifiers.
Of course, we can add a new record subsystem in the spirit of SRFI 99
but then we are back to the problems of R6RS with too basically
incompatible record systems.
So I think it is better to look for some solution that works with all
types of R7RS-small records and any implementation. We cannot use the
record-type descriptor of R7RS-small because it doesn't have to be a
value nor syntax but could be some other type of entity. So the
compatible way to extract a runtime record type descriptor is to
extract it from an instance.
Fields do not have to have unique names when converted to symbols. So
the interface either has to build on iterators or on indices.
I think this is all solvable (but cannot be a subset of SRFI 99) and
would make up a good SRFI.
Marc
PS Whether such an interface helps for pattern matching is another
matter. If procedural, it cannot be a simple interface based on
symbols but will have to be tied to the low-level representations of
identifiers and will only work with procedural macros. A syntactic
interface (which would be orthogonal to the one you describe) that
works with syntax-rules could be added as well.