Re: Subtyping and generic procedures Wolfgang Corcoran-Mathe 09 Oct 2020 00:24 UTC
Hi Ben, and thanks for opening this discussion here.
On 2020-10-08 18:22 -0400, Ben Davenport-Ray wrote:
> As I understand it, the main issue is that there is not an agreed
> upon general ordering for what built in types should be subtypes
> of other types.
As far as I can tell, there seems to be no agreement on what is
meant by "subtyping", and whether this implies some kind of object
system with inheiritance, something like the typeclass-based approach
of ML-family languages, or some other approach to generic programming.
> I think this issue can be sidestepped by instead dispatching over
Comparators provide a simple version of this idea, restricted to
types which can be meaningfully compared for equality, ordered, or
hashed. The approach used by SRFI 128--bundling sets of procedures
and dispatching based on type predicates--is easy to generalize.
I do hope that, in discussing Scheme types, we consider the research
that has been done in the field of type theory, and don't limit the
discussion to ideas drawn from the OOP community. Typeclasses,
in particular, have proven to be a very successful approach, in
other languages, to generalizing operations across various types.
Wolfgang Corcoran-Mathe <email@example.com>
"Computer science is no more about computers than astronomy is
about telescopes." --pseudo-Dijkstra