3 ms·
The point is that with first-class types you can do O(1) method lookups, whereas with type predicates you can't get better than O(N), where N is the number of t
by pwpwp 14y ago
The point is that with first-class types you can do O(1) method lookups, whereas with type predicates you can't get better than O(N), where N is the number of types.
- kwantam 14y agoNot true. In Scheme you could implement an O(1) lookup for user types plus a cascade for built-in types. The number of built-in types is small and constant, so it should not impose much overhead.
- pwpwp 14y agoIt's true. Yes you can get O(1) for user-defined types and O(N) for built-in types (of which Scheme has at least a dozen), but you can't get O(1) for all types, as with first-class type tags.