[Openmcl-devel] Type-of and positive/negative integers

Steven Nunez steve_nunez at yahoo.com
Wed Oct 23 23:30:42 PDT 2019


I've been stumped by trying to understand why:
? (type-of -3)
FIXNUM
? (type-of 3)
(INTEGER 0 1152921504606846975)
?
return different types. I know that type-of is somewhat ill-defined, but in my reading of the spec, '3' should also be a fixnum, since it is between most-negative-fixnum and most-positive-fixnum. CLtL2 suggests that implementors return the most specific type, and that would also be fixnum. Steele later points out some flaws in the current specification of type-of. Both CCL and SBCL exhibit this behaviour.
Two questions for the smart ones out there:
   
   - Is there something in the spec that I missed that makes type-of behave this way?
   - Is there a way to do a type checking assertion for fixnums that works with both positive and negative integers? I am trying to optimize some numerical functions.   


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20191024/72647b71/attachment.htm>


More information about the Openmcl-devel mailing list