Ah, I see. There is freedom on the part of implementations here.<div><br></div><div>thanks<br><br><div class="gmail_quote">On Tue, Oct 9, 2012 at 3:36 PM, Alan Ruttenberg <span dir="ltr"><<a href="mailto:alanruttenberg@gmail.com" target="_blank">alanruttenberg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br><div class="gmail_quote"><div class="im">On Tue, Oct 9, 2012 at 2:34 PM, archisman rudra <span dir="ltr"><<a href="mailto:archi.rudra@gmail.com" target="_blank">archi.rudra@gmail.com</a>></span> wrote:<br>
</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Is this correct behavior?</div><div><br></div><div>CL-USER(17): (type-of 1234567898723618080928927362387)</div><div>(INTEGER <a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a>)</div><div><br>
</div><div><br></div><div><br></div><div>The relevant java code is in Bignum.java: (the value field is a java BigInteger) </div>
<div><br></div><div><div> @Override</div><div> public LispObject typeOf()</div><div> {</div><div> if (value.signum() > 0)</div><div> return list(Symbol.INTEGER,</div><div> new Bignum((long)Integer.MAX_VALUE + 1));</div>
<div> return Symbol.BIGNUM;</div><div> }</div></div><div><br></div><div><br></div><div><br></div><div>for comparison:</div><div><div>CL-USER(23): (type-of -1234567898723618080928927362387)</div><div>BIGNUM</div></div>
<div><br></div><div><br></div><div>which makes intuitive sense.</div></blockquote></div></div><div><a href="http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm" target="_blank">http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm</a></div>
<p><b>Relevant bits of type-of description:</b></p><p></p><p></p><p>Returns a <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type_specifier" target="_blank"><i>type specifier</i></a>, <i>typespec</i>, for a <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type" target="_blank"><i>type</i></a> that has the <i>object</i> as an <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_e.htm#element" target="_blank"><i>element</i></a>. The <i>typespec</i> satisfies the following:</p>
<p></p><p></p><dl><p style="font-family:Times;font-size:medium"></p><dt style="font-family:Times;font-size:medium">1. For any <i>object</i> that is an <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_e.htm#element" target="_blank"><i>element</i></a> of some <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_b.htm#built-in_type" target="_blank"><i>built-in type</i></a>:<p>
</p></dt><dd style="font-family:Times;font-size:medium"><p></p><dl><dt>a. the <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type" target="_blank"><i>type</i></a> returned is a <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_r.htm#recognizable_subtype" target="_blank"><i>recognizable subtype</i></a> of that <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_b.htm#built-in_type" target="_blank"><i>built-in type</i></a>.<p>
</p></dt><dd></dd><dt>b. the <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type" target="_blank"><i>type</i></a> returned does not involve <tt>and</tt>, <tt>eql</tt>, <tt>member</tt>, <tt>not</tt>, <tt>or</tt>, <tt>satisfies</tt>, or <tt>values</tt>.<p>
</p></dt><dd></dd></dl><p></p></dd><dt style="font-family:Times;font-size:medium">3. The <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#type" target="_blank"><i>type</i></a> returned by <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/f_tp_of.htm#type-of" target="_blank"><b>type-of</b></a> is always a <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_r.htm#recognizable_subtype" target="_blank"><i>recognizable subtype</i></a> of the <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_c.htm#class" target="_blank"><i>class</i></a> returned by <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/f_clas_1.htm#class-of" target="_blank"><b>class-of</b></a>. That is,</dt>
<dt style="font-family:Times;font-size:medium"><p></p></dt><dd style="font-family:Times;font-size:medium"><pre> (subtypep (type-of object) (class-of object)) => <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#true" target="_blank">true</a>, <a rel="DEFINITION" href="http://www.lispworks.com/documentation/lw51/CLHS/Body/26_glo_t.htm#true" target="_blank">true</a>
</pre><p></p></dd></dl><div><br></div><div>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.</div><div>
<br></div><div>-Alan</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div><br></div><div><br></div><div><br></div>
<br>_______________________________________________<br>
armedbear-devel mailing list<br>
<a href="mailto:armedbear-devel@common-lisp.net" target="_blank">armedbear-devel@common-lisp.net</a><br>
<a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div>