Agreed that it would be implementation dependent, but if the type info has to be calculated every time on the fly it can be both inefficient and incorrect (if all values are just bytes, it could satisfy more than one disjointed types that lead to incorrect semantics), hence I venture that Scheme value has type attached - but sure would love to be enlightened on this point.
<br><br>Regarding whether a list of number is a list or a list of numbers - I can see that comes up with either predicates or type info, so don't see a disadvantage one way or another, but predicate-based approach just makes type dispatching more manual.
<br><br>Anyhow - just wondering about the reason(s) not to provide type info - sure love to know the historical design decisions ;)<br><br>Thanks,<br>yinso<br><br><div><span class="gmail_quote">On 6/10/07, <b class="gmail_sendername">
Jos Koot</b> <<a href="mailto:jos.koot@telefonica.net">jos.koot@telefonica.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff"><span class="q">
<div>----- Original Message ----- </div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="yinso.chen@gmail.com" href="mailto:yinso.chen@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">YC</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a title="jos.koot@telefonica.net" href="mailto:jos.koot@telefonica.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Jos Koot</a> ; <a title="plt-scheme@list.cs.brown.edu" href="mailto:plt-scheme@list.cs.brown.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">PLT Scheme List</a> ; <a title="nikander@nc.rr.com" href="mailto:nikander@nc.rr.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Robert Nikander</a>
</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Monday, June 11, 2007 12:47
AM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> Re: [plt-scheme] (typeof
obj)</div>
<div><br></div>
<div>This is something I wonder as well... given that internally Scheme *does
know* about the type of a value, why isn't there a function that expose the
information? Type-based dispatching is after all a legitimate
development technique. </div></blockquote></span>
<div><font face="Arial"><font size="2"><font face="Arial" size="2">I am not
sure whether or not Scheme *does know* THE type of a value. I am sure
the PLT team has more knowledge of that. My way of looking at it is that there
are predicates that know whether or not a value satisfies them. Furthermore
there is the question how far you want to go in specifying the type. Is a list
of numbers simply a list or is it 'a list of numbers'? The number of predicates
you may think of is unlimited.</font></font></font></div><span class="sg">
<div><font face="Arial" size="2">Jos Koot</font></div></span><div><span class="e" id="q_113192334e3c113a_4">
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>Thanks,<br>yinso <br><br></div>
<div><span class="gmail_quote">On 6/10/07, <b class="gmail_sendername">Jos
Koot</b> <<a href="mailto:jos.koot@telefonica.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jos.koot@telefonica.net</a>>
wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>-----
Original Message -----<br>From: "Robert Nikander" <<a href="mailto:nikander@nc.rr.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nikander@nc.rr.com</a>><br>To: "PLT
Scheme List" <<a href="mailto:plt-scheme@list.cs.brown.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
plt-scheme@list.cs.brown.edu</a>><br>Sent: Sunday, June 10, 2007 6:28
PM<br>Subject: [plt-scheme] (typeof obj)<br><br><br>> Is there a way to
get a type-name symbol or type object for any scheme<br>>
object?<br><br>Of course there is a way, but you may not like
it:<br><br>(define (types-of x) (filter identity (map (lambda (predicate
typename) (and<br>(predicate x) type-name)) predicates
type-names)))<br>(define predicates (list integer? procedure?, etc)
<br>(define type-names '(integer procedure, etc))<br><br>Of course the
procedure returns a list of types, for a 1 is an integer, a<br>rational, a
real and a complex number.<br>You also can think of adapting procedure
make-struct-type, such as to add their <br>predicates and names to the
lists.<br>Same for define-struct, let-struct ...<br>Same for
classes.<br><br>If you want only one type returned in stead of a list, two
conditions must be<br>met:<br>First: for every two types A and B either A
and B disjunct or A a subset of B or <br>B a subset of A.<br>Second:
carefully compose the lists of predicates and their names.<br>Jos
Koot<br><br>><br>> (type 1) => 'integer<br>><br>>
or<br>><br>> (type 1) => #<type integer> <br>> (type (type
x)) => #<type type><br>><br>><br>> Rob<br>>
_________________________________________________<br>> For
list-related administrative tasks:<br>> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>><br><br>_________________________________________________<br> For
list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br></blockquote></div><br></blockquote></span></div></div>
</blockquote></div><br>