On Wed, Jan 2, 2019 at 1:47 AM Alex Shinn <xxxxxx@gmail.com> wrote:

Given that in the current R7RS there is no notion of type
beyond type predicates, this implementation-strategy would
be allowed, but it may leak with future extensions.

I assume you mean record introspection?  Let it leak.  Anyone is
free to implement any type as a record or not.  In SICL, a new
in-progress implementation of Common Lisp, everything is a
CLOS instance (basically a tuple with a pointer to the class object
and a pointer to the instance data, which always includes the version
number of the class object, to detect obsolete instances) except 
immediates and pairs (because they are very common and are
already just two pointers), which are recognized by type tags.
 
Would it be reasonable to say that the types are disjoint from
all other types except possibly each other?

Disjointness just means that the objects on which
the type predicates return #t are belong to disjoint
(mathematical) sets.  Since we don't yet know all the
type predicates, this is a promise that can't quite be
fulfilled yet, but the intention is that it will end up being
true at the end of the R7RS-large process.  So the
important point here is that u8vector? and u16vector?
never both return #t on the same object.

There are a few cases where non-disjointness is explicit:
in particular, the fact that SRFI 127 lazy sequences are
(typically improper) lists is deliberately exposed, as is
the fact that the insides of SRFI 117 list queues are
in fact lists rather than random sequence objects.

Note that sets and bags in the sample
 implementation of SRFI 113 are a single record type: a
comparator, a hash table mapping elements to the number of
occurrences, and a flag.  The set-* and bag-* procedures just
check the flag for correctness and then call the corresponding
unexported sob-* procedure.  If saving code space is an issue,
you can always make all three of set-*, bag-* and sob-* the
same procedures.

There turn out to be only two places in the code where it's
necessary to check the flag and do something different:
in the primitive routine to add an element used by various
sob-* procedures, and in another primitive routine that
is used by the set-theoretic operators.  Both basically
bound the count to 1.

-- 
John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
Her he asked if O'Hare Doctor tidings sent from far coast and she with
grameful sigh him answered that O'Hare Doctor in heaven was.  Sad was the
man that word to hear that him so heavied in bowels ruthful.  All she
there told him, ruing death for friend so young, algate sore unwilling
God's rightwiseness to withsay.   Joyce, Ulysses, "Oxen of the Sun"