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

Type specifiers in THE constructs



    Date: Saturday, 23 January 1988  01:07-EST
    From: Jon L White <edsel!jonl at labrea.Stanford.EDU>
    To:   labrea!common-lisp%su-ai at labrea.Stanford.EDU
    Re:   Type specifiers in THE constructs

    Does the type-specifier in  (THE <type-spec> (MUMBLE))  refer to the type
    of the first value (of zero or more values) returned by (MUMBLE), or does
    it refer to the multiple-value spectrum?  In short, is is a shorthand for
      1.    (THE (VALUES <type-spec> &REST T) (MUMBLE))
    or for
      2.    (THE (VALUES <type-spec>) (MUMBLE))

I suggest the first interpretation, with a note that when the
<type-spec> is a VALUES type, THE should enforce exactly the specified
values.  (which may be what you had in mind)  Hence:
    (THE NUMBER (TRUNCATE 10 3)) ;legal
    (THE (VALUES NUMBER) (TRUNCATE 10 3)) ; illegal

I could also live with the second interpretation.  I just wanted to
make clear that I consider the multiple-value semantics of THE to be
useful.  Even if use of a non-values type required a single value, it
would be worth supporting THE VALUES so that multiple value results
can be declared.

Although interpretation 1 may seem a bit sleazy, it is consistent with
the general value-count sleaze in Common Lisp.

  Rob