<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Bottom type - Page 6 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=Bottom_type&amp;p=5">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Bottom_type&amp;p=7">3.Next</a>
</p>
<p><code>int</code> and other primitive types.<br/>
# A type system including both Top and Bot seems to be a natural target for <a href="page.php?w=type_inference">type inference</a>, allowing the constraints on an omitted type parameter to be captured by a pair of bounds: we write S<:X<:T to mean "the value of X must lie somewhere between S and T." In such a scheme, a completely unconstrained parameter is bounded below by Bot and above by Top.</p>

<p><big>In programming languages</big></p>
<p>Most commonly used languages don't have a way to denote the bottom type.  There are a few notable exceptions.</p>

<p>
* In <a href="page.php?w=Haskell_%28programming_language%29">Haskell</a>, the bottom type is called <code>Void</code>.<br/>
* In <a href="page.php?w=Common_Lisp">Common Lisp</a> the type <code>NIL</code>, contains no values and is a subtype of every type. The type named <code>NIL</code> is sometimes confused with the type named <code>NULL</code>, which has one value, namely the symbol <code>NIL</code> itself.<br/>
* In <a href="page.php?w=Scala_%28programming_language%29">Scala</a>, the bottom type is denoted as <code>Nothing</code>.  Besides its use for functions that just throw exceptions or otherwise don't return normally, it's also used for <a href="page.php?w=Covariance_and_contravariance_%28computer_science%29">covariant</a> <a href="page.php?w=Parametric_polymorphism">parameterized types</a>.  For example, Scala's List is a covariant type constructor, so <code>List[Nothing]</code> is a subtype of <code>List[A]</code> for all types A.  So Scala's <code>Nil</code>, the object for marking the end of a list of any type, belongs to the type <code>List[Nothing]</code>.<br/>
* In <a href="page.php?w=Rust_%28programming_language%29">Rust</a>, the bottom type is called the never type and is denoted by <code>!</code>. It is present in the type signature of functions guaranteed to never return, for example by calling <code>panic!()</code> or looping forever. It is also the type of certain control-flow keywords, such as <code>break</code> and <code>return</code>, which do not produce a value but are nonetheless usable as expressions.<br/>
* In <a href="page.php?w=C_%28programming_language%29">C</a> and <a href="page.php?w=C%2B%2B">C++</a>, there is no bottom type, but a function which does not return is <a href="page.php?w=Attribute_%28programming%29">annotated</a> with <syntaxhighlight lang="cpp" inline><a href="page.php?w=noreturn">noreturn</a></syntaxhighlight>, on a function that returns <code>void</code>.<br/>
* In <a href="page.php?w=Ceylon_%28programming_language%29">Ceylon</a>, the bottom type is <code>Nothing</code>. It is comparable to <code>Nothing</code> in Scala and represents the intersection of all other types as well as an empty set.<br/>
* In <a href="page.php?w=Julia_%28programming_language%29">Julia</a>, the bottom type is <code>Union{}</code>.<br/>
* In <a href="page.php?w=TypeScript">TypeScript</a>, the bottom type is <code>never</code>.<br/>
* In <a href="page.php?w=JavaScript">JavaScript</a> with <a href="page.php?w=Google_Closure_Tools">Closure Compiler</a> annotations, the bottom type is <code>!Null</code> (literally, a non-null member of the <code>Null</code> <a href="page.php?w=unit_type">unit type</a>).<br/>
* In <a href="page.php?w=PHP">PHP</a>, the bottom type is <code>never</code>.<br/>
* In <a href="page.php?w=Python_%28programming_language%29">Python</a>'s optional static type annotations, the general bottom type is <code>typing.Never</code> (introduced in version 3.11), while <code>typing.NoReturn</code> (introduced in version 3.5) can be used as the return type of non-returning functions specifically (and doubled as the general bottom type prior to the introduction of <code>Never</code>).<br/>
* In <a href="page.php?w=Kotlin_%28programming_language%29">Kotlin</a>, the bottom type is <code>Nothing</code>.<br/>
* In <a href="page.php?w=D_%28programming_language%29">D</a>, the bottom type is <code>noreturn</code>.<br/>
* In <a href="page.php?w=Dart_%28programming_language%29">Dart</a>, since version 2.12 with the , the <code>Never</code> type was introduced as the bottom type. Before that, the bottom type used to be <code>Null</code>.</p>

<p><big>See also</big></p>
<p>
* <a href="page.php?w=Contradiction">Contradiction</a><br/>
* <a href="page.php?w=Fail-stop">Fail-stop</a><br/>
* <a href="page.php?w=NaN">NaN</a><br/>
* <a href="page.php?w=Top_type">Top type</a><br/>
* <a href="page.php?w=Undefined_value">Undefined value</a><br/>
* <a href="page.php?w=Unit_type">Unit type</a><br/>
* <a href="page.php?w=Void_type">Void type</a></p>

<p><big> References </big></p>
<p><big> Further reading </big></p>
<p>
* </p>

<p></p>
<p>
<a accesskey="1" href="page.php?w=Bottom_type&amp;p=5">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Bottom_type&amp;p=7">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
