4 ms·
> This is not possible in either Scheme or Kernel. In both > languages, programming generically requires one to use a > cascade of type predicates (e.
by kwantam 14y ago
> This is not possible in either Scheme or Kernel. In both
> languages, programming generically requires one to use a
> cascade of type predicates (e.g. number?).
This is a strange claim. If it's possible to create a cascade of type predicates to identify types, then it's possible to make type-of identically that cascade (plus a lookup for the user-defined types), and now you've got the functionality in Scheme.
This is a little bit like someone complaining that Scheme isn't an object-oriented language. If you want to do OOP in Scheme, you absolutely can.
- pwpwp 14y agoThe 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.