Email list hosting service & mailing list manager

Record-type predicate Takashi Kato (17 Jul 2016 19:19 UTC)
Re: Record-type predicate Marc Nieper-Wißkirchen (18 Jul 2016 14:35 UTC)
Re: Record-type predicate John Cowan (18 Jul 2016 15:23 UTC)
Re: Record-type predicate Takashi Kato (18 Jul 2016 19:47 UTC)
Re: Record-type predicate Marc Nieper-Wißkirchen (22 Jul 2016 11:23 UTC)

Re: Record-type predicate Marc Nieper-Wißkirchen 22 Jul 2016 11:23 UTC


Am 18.07.2016 um 21:47 schrieb Takashi Kato:
>> I don't see a way to get meta-data about a procedure other than
>> calling it. But this may be disastrous if an unknown procedure is
>> called.
> That's one of my concern. And I would like to raise an error if spec
> (the SRFI) says "it is an error" however if there's no way to detect
> so that's also impossible.

For a native implementation of SRFI 136, a predicate could be of a
subtype of procedure. That is a type whose values fulfill the predicate
procedure? and, say, record-type-predicate? For such a type, a native
procedure that retrieves meta-information could be defined.

For an implementation that implements SRFI-17, this shouldn't be too hard.

>
>> For compatibility with SRFI-9 and R7RS-small, it has to return #t.
> Ok, as I expected (and made my life harder).
>
>> Do you have a use case in mind where it is crucial to hide
>> these things from the user?
> One of my thing is integration to R6RS (or even underlying object
> system). As long as I can get the meta-data, then it is possible
> to implement this SRFI on top of the existing object system (at
> least on Sagittarius). To me, it's convenient if somewhat
> meta-data object is defined (it doesn't have to be specified what
> to have, like syntax object defined on R6RS).

The primary meta-data object is the record-type descriptor, which is a
keyword. As the procedural interface cannot access a keyword, I chose
the predicate as a substitute for it for the procedural layer.

If you do think that this is ugly or hard to implement, we should
discuss the following changes/clarifications to SRFI 136:

- A record has an expand-time record-type descriptor, and an associated
evaluation-time record-type descriptor.

- The expand-time rtd is the keyword <type name> bound by
(define-record-type <type spec> ...).

- The macro use (<type name>) expands into the evaluation-time rtd.
(Currently: The predicate is the evaluation-time rtd.)

- In the procedural layer, one makes use of the evaluation-time rtd to
refer to record-types (Currently: predicate).

- Contrary to the predicate, the evaluation-time rtd would belong to a
disjoint type.

Best,

Marc

>
>
> Cheers,
>