<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="stylesheet.css" ?>

<!-- Copyright 2003 Steve Folta -->

<cleet-doc xmlns:xlink="http://www.w3.org/1999/xlink">

<title> Stand-In Types </title>


<header> What They Are </header>

<p>
Stand-in types are Cleet's mechanism to allow collections to be used to
store any class, with full compile-time type checking.  They serve the
same purpose that C++'s templates usually do.  They are also by far the
most broken feature of the current compiler, which barely handles them
well enough to make the <id>List</id> class work.
</p>


<header> Using Stand-In Types </header>

<p>
To see how stand-in types are declared and used, let's look at an
excerpt from the source for <id>List</id>:
</p>

<code>Class: List
Stand-In-Types: Type

append(object: Type)
{
  // ...
}

first-item: Type
{
  // ...
}</code>


<p>
<id>Type</id> is the stand-in type, and can represent any class. 
<i>Which</i> class it represents is determined when a variable of type
<id>List</id> is declared:
</p>

<code>names: List of String;

names.append("Hello");
some-name: String = names.first-item;</code>


<p>
Using the wrong type will raise an error at compile time.  For example,
this is illegal:
</p>

<code>names.append(new MyClass);</code>


<p>
What happens if you don't give the type?  In that case it defaults to
<id>Object</id>.  So the following two declarations are equivalent:
</p>


<code>list: List;
list: List of Object;</code>


</cleet-doc>
