>>> However, generic functions in Scheme have many of the same >>> performance issues as the SRFI 225 (first draft) registration system. >>> Since the only portable typing mechanism we have are predicates, not >>> type descriptors, the only easy way for many implementations to do >>> typing dispatch is calling each predicate in turn. >> >> Fast-generics allows you to specify predicate subsumptions, which is >> isomorphic to subtype relationships. If the predicate P1 subsumes P2, >> then the type of objects satisfying P2 is a subtype of the type of >> objects satisfying P1. So when doing fast-generics on top of a >> JVM/CLR style type tree, we extend the subsumption relation to know >> about its subtypes, and then we can cleverly make use of its built-in >> dispatching. > > Yes, but predicates can be arbitrary Scheme procedures in a way that > type descriptors corresponding to Java classes/etc can't be, making > this trickier. Yes, it is trickier for the compiler. Naive implementations exists, performant implementation are possible. Also, Java classes/etc lack generality compared to predicate-based approach, and are trickier to explain / teach. I also somewhat off-topic to this paragraph, I want to add that at least in Python, inheritance outside the exception hierarchy is seldom used in the stdlib. What is pervasive in Python is protocols also known under the nickname of duck-typing. As far as I know, doing something like duck-typing in Java requires both classes and interface... predicates subsume all of that and are easier to understand [0]. > (I guess we make it ‘an error’ to use a predicate which > isn’t one of a disjoint type That is not necessary to specify that in the standard. Like I wrote above simple approach exists, complex solution are possible. > as defined in the spec or created by > define-record-type or whatever procedural records layer we adopt?) To me the question is more complex than "can it be performant as of today _on top_ of existing implementations" and "what is the favorite paradigm in other languages". I am not saying that what people in this thread wrote or think, but that what comes to my mind when reading. We should aim for perfection in many aspects: performance, ease of understanding and teaching, ease of programming, ease of maintenance of compilers and programs. [0] it is still possible to shoot one-self in the foot in the cases where predicates describes non-disjoint sets, some cases can be statically spotted by the compiler (easier with the help of predicates combinators). Still, the common case is to dispatch based on disjoint types. I guess "great power comes with great responsibility".