1 <!-- This file is part of Shapes. -->
3 <!-- Shapes is free software: you can redistribute it and/or modify -->
4 <!-- it under the terms of the GNU General Public License as published by -->
5 <!-- the Free Software Foundation, either version 3 of the License, or -->
6 <!-- any later version. -->
8 <!-- Shapes is distributed in the hope that it will be useful, -->
9 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
10 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
11 <!-- GNU General Public License for more details. -->
13 <!-- You should have received a copy of the GNU General Public License -->
14 <!-- along with Shapes. If not, see <http://www.gnu.org/licenses/>. -->
16 <!-- Copyright 2009, 2013 Henrik Tidefelt -->
18 <section id="types/special">
19 <title>Special types</title>
21 <p>The classes in this section are the foundation of the type hierarchy in <str-Shapes />. You can do quite a lot in <str-Shapes /> without knowing about these types, but they become central as soon as you want to deal with the types of values.</p>
24 <coretype name="Object">
26 <p>Every other type in <str-Shapes /> is a subtype of <named-type name="Object" />.</p>
29 <p>It is impossible to create values of type <named-type name="Object" />, but the type is useful as the “any type”.</p>
30 <p>Note that it is by intention that <named-type name="Object" /> has no fields, to avoid name clashes with derived types. Instead, core functions such as <value namespace="..Shapes" name="typeof" /> are used to access properties of any value.</p>
33 <value namespace="..Shapes" name="typeof" /> <value namespace="..Shapes..Data" name="nil?" />
37 <coretype name="Class">
39 <p>The type of types.</p>
42 <p>The <named-type name="Class" /> objects are the runtime representation of types in <str-Shapes />.</p>
43 <p>At the time of writing <str-Shapes /> does not really have a type hierarchy, so there is no way support for checking the subtype relationship (the only non-trivial such relation is that between any type and <named-type name="Object" />, which never has to be tested anyway). This will change in the future.</p>
46 <type-field name="name">
47 <type><named-type name="String" /></type>
48 <description><p>A short textual description of the type, useful for debugging purposes.</p></description>