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

(SYMBOL? #t) ==> ?

    Date: Thu, 10 Mar 88 14:12:19 est
    From: Michael R. Blair <ziggy at VX.LCS.MIT.EDU>
    To:   jar
    Re:   (SYMBOL? #t) ==> ?

     Chris Hanson and I noticed a possible non-ideality in the
    Revised^3 report. Specifically,

      (SYMBOL? #t) ==> ?

     We think it should be #f but the manual does not specify?

I'm not sure why you single out the question of disjointness of the
boolean and symbol types; the report is also mute on the question of
what (pair? 3) returns.  One might infer from the formal semantics that
the types explicitly listed in the domain equation for expressed values
are disjoint, but some uncertainty is in order since

(a) the semantics of the built-in type predicates aren't given,

(b) the text says that certain deviations from the domain equations are
allowed (e.g. characters needn't be a distinct type, and () possibly=
#f); so why not others?

My interpretation is that types must be disjoint except where explcitly
stated otherwise in the text of the report.  In particular:
   (number? 'a)   => #f
   (symbol? #t)   => #f
   (boolean? 't)  => #f
   (vector? #\c)  => unspecified
   (boolean? '()) => unspecified

Common Lisp: The Language addresses the question of type disjointness in
a brief section devoted to that purpose.  The scheme report should also
say something explicit on this topic.  Before the report can say
something comprehensive, however, the rrrs-authors will have to decide
some sticky, previously unraised questions:

    - Are the input-port and output-port types distinct from the others?
      [My opinion: yes, as long as all implementations already do this.]
    - Is the procedure type disjoint from others?
    - Is the type of promises disjoint from the others?
      [No, it's acceptable to implement them as procedures or vectors.]
    - Is the type of eof-objects disjoint from the others?
      [I don't care.]

>From the above it's clear that we don't really have adequate terminology
to talk about this question.  I want adjectives to apply to the word
"type" to distinguish the class of types that are known to be disjoint
from each other (and thus distinguishable using type predicates:  (foo?
x) = (bar? x) iff foo = bar) from the class of types that
aren't (in which case you might have a foo? predicate but no claim about
what other predicates return for things for which foo? returns true).
Suggestions?  Something like "latent" and "manifest", except that those
mean something different.

Fortunately, Scheme as it stands doesn't have subtyping like Common Lisp
does (except among number types, which are already dealt with), so it
should be possible to make the discussion tighter and less confusing
than that in CLtL.