[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Types in Scheme

It is with some regret and with anticipation of a barrage of heated replies
that I make the following statements.
If the goals of our type predicates are to enable the writing of portable code
and to make the writing of some other forms of code easier, then I believe that
we really need two sets of type predicates:  one based on the functionlity
intended for an object and the other based on its representation.  I 
will prefix the predicates of the latter type with the word primitive in the 
following examples for expository purposes.
(symbol? 'a) ==> #t
(number? 'a) ==> #f
(primitive-number? 'a) ==> unspecified (depends on whether this implementation
                                        represents symbols as numbers)
Such a type system allows complete flexibility in terms of implementation while
still supporting a maximum amount of type safety.  It also allows the 
programmer to specify exactly what he means when he uses a type predicate.
Does he care about how the object is being used or what its actual
representation is.  These a two quite different things.
					Morry Katz