Ah, I see. There is freedom on the part of implementations here.

thanks

On Tue, Oct 9, 2012 at 3:36 PM, Alan Ruttenberg <alanruttenberg@gmail.com> wrote:


On Tue, Oct 9, 2012 at 2:34 PM, archisman rudra <archi.rudra@gmail.com> wrote:
Is this correct behavior?

CL-USER(17): (type-of 1234567898723618080928927362387)
(INTEGER 2147483648)



The relevant java code is in Bignum.java: (the value field is a java BigInteger) 

  @Override
  public LispObject typeOf()
  {
    if (value.signum() > 0)
      return list(Symbol.INTEGER,
                   new Bignum((long)Integer.MAX_VALUE + 1));
    return Symbol.BIGNUM;
  }



for comparison:
CL-USER(23): (type-of -1234567898723618080928927362387)
BIGNUM


which makes intuitive sense.
http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm

Relevant bits of type-of description:

Returns a type specifiertypespec, for a type that has the object as an element. The typespec satisfies the following:

1. For any object that is an element of some built-in type:

a. the type returned is a recognizable subtype of that built-in type.

b. the type returned does not involve andeqlmembernotorsatisfies, or values.

3. The type returned by type-of is always a recognizable subtype of the class returned by class-of. That is,

 (subtypep (type-of object) (class-of object)) =>  true, true


So my read is that there's no guarantee of literal repeatability between the returned values of type-of even in subsequent calls, never mind between implementations.

-Alan

 





_______________________________________________
armedbear-devel mailing list
armedbear-devel@common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel