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 18 Jul 2016 14:35 UTC


Am 17.07.2016 um 21:19 schrieb Takashi Kato:
> Hi,
>
> I have couple of questions about record-type predicate.
>
> - I assume it's an error if make-record gets non record-type predicate.
>    Then how can we check if the given argument is record-type predicate or
>    not?
I don't think that it is possible in a portable and efficient way. The
record-type predicate has to be a procedure in order to function as a
genuine predicate. If we don't want to index these functions in (weak)
hash tables, 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.

> - Related to above, must record-type predicate be a procedure? Or can be an
>    applicable something? (c.f. must procedure? return #t if it gets
>    record-type predicate?)
For compatibility with SRFI-9 and R7RS-small, it has to return #t.
> - Is it possible for users to create no predicate record type using only
>    procedural layer? And if this is possible, how can I retrieve fields from
>    the record instance?
It isn't possible to create no predicate. Even with the syntactic layer,
a predicate can always be generated via record-type-predicate when an
instance is given.

Do you have a use case in mind where it is crucial to hide these things
from the user?

--

Marc