From: Nathan T. <nb...@nb...> - 2013-10-19 02:34:55
|
Can someone either confirm that this is a bug or explain why it is not: | * (the (values fixnum fixnum) 1) | => 1 | | * (the (values fixnum fixnum) (values 1)) | ; in: THE (VALUES FIXNUM FIXNUM) | ; (THE (VALUES FIXNUM FIXNUM) (VALUES 1)) | ; | ; caught WARNING: | ; Derived type of #:G0 is | ; (VALUES (INTEGER 1 1) &OPTIONAL), | ; conflicting with its asserted type | ; (VALUES FIXNUM FIXNUM &REST T). | ; See also: | ; The SBCL Manual, Node "Handling of Types" | ; | ; compilation unit finished | ; caught 1 WARNING condition | | debugger invoked on a SIMPLE-TYPE-ERROR in thread | #<THREAD "main thread" RUNNING {1003853333}>: | Value set | [1] | from #:G0 in | (THE (VALUES FIXNUM FIXNUM) (VALUES 1)) | is not of type | (VALUES FIXNUM FIXNUM &REST T). >From CLHS: "It is permissible for form to yield a different number of values than are specified by value-type, provided that the values for which types are declared are indeed of those types. Missing values are treated as nil for the purposes of checking their types." Strictly speaking, I don't think this is a conformance bug, since the semantics of declarations is largely implementation-defined. However, it does seem very inconsistent. To my mind, the first form should yield the same error as the second, since the missing second value ought to be treated as NIL, which is not a FIXNUM. |