<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=ATS_%28programming_language%29</id>
	<title>ATS (programming language) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=ATS_%28programming_language%29"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=ATS_(programming_language)&amp;action=history"/>
	<updated>2026-05-12T15:09:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=ATS_(programming_language)&amp;diff=7486361&amp;oldid=prev</id>
		<title>80.71.133.84 at 10:25, 22 January 2025</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=ATS_(programming_language)&amp;diff=7486361&amp;oldid=prev"/>
		<updated>2025-01-22T10:25:54Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Programming language}}&lt;br /&gt;
{{Multiple issues|&lt;br /&gt;
{{Primary sources|date=March 2018}}&lt;br /&gt;
{{how-to|date=February 2020}}&lt;br /&gt;
{{Technical|date=September 2020}}&lt;br /&gt;
}}&lt;br /&gt;
{{Infobox programming language&lt;br /&gt;
| name = ATS&lt;br /&gt;
| logo = The ATS Logo.svg&lt;br /&gt;
| paradigms = [[Comparison of multi-paradigm programming languages|multi-paradigm]]: [[Functional programming|functional]], [[Imperative programming|imperative]], [[Object-oriented programming|object-oriented]], [[Concurrent computing|concurrent]], [[Modular programming|modular]]&lt;br /&gt;
| family = [[ML (programming language)|ML]]: [[Caml]]: [[OCaml]]: [[Dependent ML]]&lt;br /&gt;
| released = {{Start date and age|2006}}&lt;br /&gt;
| designer = Hongwei Xi&lt;br /&gt;
| developer = [[Boston University]]&lt;br /&gt;
| latest release version = ATS2-0.4.2&amp;lt;ref&amp;gt;{{cite web |url=https://groups.google.com/g/ats-lang-users/c/ZlSW70S525Y |title=[ats-lang-users] ATS2-0.4.2 released |last=Xi |first=Hongwei |website=ats-lang-users |date=14 November 2020 |access-date=17 November 2020}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| latest release date = {{Start date and age|2020|11|14}}&lt;br /&gt;
| typing = [[Static typing|static]], [[Dependent type|dependent]]&lt;br /&gt;
| implementations = &lt;br /&gt;
| dialects = &lt;br /&gt;
| influenced by = [[Dependent ML]], [[ML (programming language)|ML]], [[OCaml]], [[C++]]&lt;br /&gt;
| influenced = &lt;br /&gt;
| operating system = &lt;br /&gt;
| file ext = .sats, .dats, .hats&lt;br /&gt;
| license = [[GNU General Public License|GPLv3]]&lt;br /&gt;
| website = {{URL|www.ats-lang.org}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In computing, &amp;#039;&amp;#039;&amp;#039;ATS&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;Applied Type System&amp;#039;&amp;#039;&amp;#039;) is a [[Comparison of multi-paradigm programming languages|multi-paradigm]], [[General-purpose programming language|general-purpose]], [[High-level programming language|high-level]], [[Functional programming|functional]] [[programming language]]. It is a [[Dialect (computing)|dialect]] of the programming language [[ML (programming language)|ML]], designed by Hongwei Xi to unify [[computer programming]] with [[formal specification]]. ATS has support for combining [[theorem proving]] with practical programming through the use of advanced [[type system]]s.&amp;lt;ref name=&amp;quot;ats-lang.org&amp;quot;&amp;gt;{{Cite web |url=http://www.ats-lang.org/MYDATA/CPwTP-icfp05.pdf |title=Combining Programming with Theorem Proving |access-date=2014-11-18 |archive-date=2014-11-29 |archive-url=https://web.archive.org/web/20141129050328/http://www.ats-lang.org/MYDATA/CPwTP-icfp05.pdf |url-status=dead}}&amp;lt;/ref&amp;gt; A past version of [[The Computer Language Benchmarks Game]] has demonstrated that the performance of ATS is comparable to that of the languages [[C (programming language)|C]] and [[C++]].&amp;lt;ref&amp;gt;[https://web.archive.org/web/20121218042116/http://shootout.alioth.debian.org/u64/ats.php ATS benchmarks | Computer Language Benchmarks Game] (web archive)&amp;lt;/ref&amp;gt; By using theorem proving and strict type checking, the compiler can detect and prove that its implemented functions are not susceptible to bugs such as [[division by zero]], [[memory leak]]s, [[buffer overflow]], and other forms of [[memory corruption]] by verifying [[pointer arithmetic]] and [[reference counting]] before the program runs. Also, by using the integrated theorem-proving system of ATS (ATS/LF), the programmer may make use of static constructs that are intertwined with the operative code to prove that a function conforms to its specification.&lt;br /&gt;
&lt;br /&gt;
ATS consists of a static component and a dynamic component. The static component is used for handling types, whereas the dynamic component is used for programs. While ATS primarily relies on a call-by-value functional language at its core, it possesses the ability to accommodate diverse [[programming paradigm]]s, such as [[Functional programming|functional]], [[Imperative programming|imperative]], [[Object-oriented programming|object-oriented]], [[Concurrent computing|concurrent]], and [[Modular programming|modular]].&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
According to the author, ATS was inspired by Martin-Löf&amp;#039;s [[Intuitionistic type theory|constructive type theory]], which was originally developed for the purpose of establishing a foundation for mathematics. Xi designed ATS “in an attempt to combine specification and implementation into a single programming language.”&amp;lt;ref&amp;gt;{{Cite web |title=Introduction to Programming in ATS |url=https://ats-lang.github.io/DOCUMENT/INT2PROGINATS/HTML/INT2PROGINATS-BOOK-onechunk.html |access-date=2024-02-23 |website=ats-lang.github.io}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ATS is derived mostly from the languages [[ML (programming language)|ML]] and [[OCaml]]. An earlier language, [[Dependent ML]], by the same author has been incorporated into ATS.&lt;br /&gt;
&lt;br /&gt;
The first implementation, ATS/Proto (ATS0), was written in OCaml and was released in 2006. This was the pre-first edition of ATS and is no longer maintained. A year later, ATS/Geizella, the first implementation of ATS1, was released. This version was also written in OCaml and is no longer used actively.&amp;lt;ref name=&amp;quot;:0&amp;quot;&amp;gt;{{Cite web |title=ATS-PL-SYS |url=https://www.cs.bu.edu/~hwxi/atslangweb/Implements.html |access-date=2024-02-23 |website=www.cs.bu.edu}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second version of ATS1, ATS/Anairiats, released in 2008, was a major milestone in the development of the language, as the language was able to [[Bootstrapping (compilers)|bootstrap]] itself. This version was written almost completely in ATS1. The current version, ATS/Postiats (ATS2) was released in 2013. Like its predecessor, this version is also almost entirely written in ATS1. The most recently released version is ATS2-0.4.2.&amp;lt;ref name=&amp;quot;:0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Future ==&lt;br /&gt;
{{As of|2024}}, ATS is used mostly for research; less than 200 [[GitHub]] repositories contain code written in ATS. This is far less than other functional languages, such as OCaml and Standard ML, which have over 16,000 and 3,000 repositories, respectively. This is likely due to the steep learning associated with ATS, which is present because of the language&amp;#039;s use of [[dependent type]]-checking and template instance resolution. These features usually require the use of explicit [[Quantifier (logic)|quantifiers]], which demand further learning.&amp;lt;ref name=&amp;quot;:1&amp;quot;&amp;gt;{{Cite web |last=Xi |first=Hongwei |date=2024-02-17 |url=https://github.com/githwxi/ATS-Xanadu |title=githwxi/ATS-Xanadu |website=GitHub |access-date=2024-02-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{As of|2024}}, ATS/Xanadu (ATS3) is being developed actively in ATS2, with the hope of reducing the learning needed by two main improvements:&lt;br /&gt;
* Adding an extra layer to ATS2 to support ML-like [[Algebraic data type|algebraic type]]-checking&lt;br /&gt;
* Type-based [[metaprogramming]] using algebraic types only&amp;lt;ref name=&amp;quot;:1&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With these improvements, Xi hopes for ATS to become much more accessible and easier to learn. The main goal of ATS3 is to transform ATS from a language mainly used for research, into one strong enough for large-scale industrial software development.&amp;lt;ref name=&amp;quot;:0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Theorem proving ==&lt;br /&gt;
The main focus of ATS is to support [[formal verification]] via [[automated theorem proving]], combined with practical programming.&amp;lt;ref name=&amp;quot;ats-lang.org&amp;quot;/&amp;gt; Theorem proving can prove, for example, that an implemented function produces no memory leaks. It can also prevent other bugs that might otherwise be found only during testing. It incorporates a system similar to those of [[proof assistant]]s which usually only aim to verify mathematical proofs—except ATS uses this ability to prove that the implementations of its functions operate correctly, and produce the expected output.&lt;br /&gt;
&lt;br /&gt;
As a simple example, in a function using division, the programmer may prove that the divisor will never equal zero, preventing a [[division by zero]] error. Let&amp;#039;s say, the divisor &amp;#039;X&amp;#039; was computed as 5 times the length of list &amp;#039;A&amp;#039;. One can prove, that in the case of a non-empty list, &amp;#039;X&amp;#039; is non-zero, since &amp;#039;X&amp;#039; is the product of two non-zero numbers (5 and the length of &amp;#039;A&amp;#039;). A more practical example would be proving through [[reference counting]] that the retain count on an allocated block of memory is being counted correctly for each pointer. Then one can know, and quite literally prove, that the object will not be deallocated prematurely, and that [[memory leak]]s will not occur.&lt;br /&gt;
&lt;br /&gt;
The benefit of the ATS system is that since all theorem proving occurs strictly within the compiler, it has no effect on the speed of the executable program. ATS code is often harder to compile than standard [[C (programming language)|C]] code, but once it compiles, it is certain that it is running correctly to the degree specified by the proofs (assuming the compiler and runtime system are correct).&lt;br /&gt;
&lt;br /&gt;
In ATS proofs are separate from implementation, so it is possible to implement a function without proving it, if desired.&lt;br /&gt;
&lt;br /&gt;
== Data representation ==&lt;br /&gt;
According to the author, ATS&amp;#039;s efficiency&amp;lt;ref&amp;gt;[https://www.reddit.com/r/programming/comments/72hmw/language_shootout_ats_is_the_new_top_gunslinger/ Discussion about the language&amp;#039;s efficiency (Language Shootout: ATS is the new top gunslinger. Beats C++.)]&amp;lt;/ref&amp;gt; is largely due to the way that data is represented in the language and [[Tail recursion|tail-call optimizations]] (which are generally important for the efficiency of functional languages). Data can be stored in a flat or unboxed representation rather than a boxed representation.&lt;br /&gt;
&lt;br /&gt;
== Theorem proving: An introductory case ==&lt;br /&gt;
&lt;br /&gt;
=== Propositions ===&lt;br /&gt;
&amp;lt;code&amp;gt;dataprop&amp;lt;/code&amp;gt; expresses &amp;#039;&amp;#039;[[Predicate (mathematical logic)|predicates]]&amp;#039;&amp;#039; as [[algebraic type]]s.&lt;br /&gt;
&lt;br /&gt;
Predicates in pseudo‑code somewhat similar to ATS source (see below for valid ATS source):&lt;br /&gt;
&lt;br /&gt;
  FACT(n, r)         [[if and only if|iff]]    fact(n) = r&lt;br /&gt;
  MUL(n, m, prod)    [[if and only if|iff]]    n * m = prod&lt;br /&gt;
   &lt;br /&gt;
  FACT(n, r) = &lt;br /&gt;
        FACT(0, 1) &lt;br /&gt;
      | FACT(n, r) iff FACT(n-1, r1) and MUL(n, r1, r)   // for n &amp;gt; 0&lt;br /&gt;
  &lt;br /&gt;
  &amp;#039;&amp;#039;// expresses fact(n) = r  [[if and only if|iff]]  r = n * r1  and  r1 = fact(n-1)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
In ATS code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 dataprop FACT (int, int) =&lt;br /&gt;
   | FACTbas (0, 1)             // basic case: FACT(0, 1)&lt;br /&gt;
   | {n:int | n &amp;gt; 0} {r,r1:int} // inductive case&lt;br /&gt;
     FACTind (n, r) of (FACT (n-1, r1), MUL (n, r1, r))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where FACT (int, int) is a proof type&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
Non tail-recursive factorial with proposition or &amp;quot;[[Theorem]]&amp;quot; proving through the construction &amp;#039;&amp;#039;dataprop&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
The evaluation of {{code|fact1(n-1)}} returns a pair &amp;lt;code&amp;gt;(proof_n_minus_1 | result_of_n_minus_1)&amp;lt;/code&amp;gt; which is used in the calculation of {{code|fact1(n)}}. The proofs express the predicates of the proposition.&lt;br /&gt;
&lt;br /&gt;
==== Part 1 (algorithm and propositions) ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ocaml&amp;quot;&amp;gt;&lt;br /&gt;
  [FACT (n, r)] implies [fact (n) = r]&lt;br /&gt;
  [MUL (n, m, prod)] implies [n * m = prod]&lt;br /&gt;
&lt;br /&gt;
  FACT (0, 1)&lt;br /&gt;
  FACT (n, r) iff FACT (n-1, r1) and MUL (n, r1, r) forall n &amp;gt; 0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remember:&lt;br /&gt;
&lt;br /&gt;
 {...} universal quantification&lt;br /&gt;
 [...] existential quantification&lt;br /&gt;
 (... | ...)   (proof | value)&lt;br /&gt;
 @(...) flat tuple or variadic function parameters tuple&lt;br /&gt;
 .&amp;lt;...&amp;gt;. termination metric&amp;lt;ref&amp;gt;{{Cite web |url=https://www.cs.bu.edu/~hwxi/ATS/TUTORIAL/contents/termination-metrics.html |title=Termination metrics |access-date=2017-05-20 |archive-date=2016-10-18 |archive-url=https://web.archive.org/web/20161018010907/http://www.cs.bu.edu/~hwxi/ATS/TUTORIAL/contents/termination-metrics.html |url-status=dead}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ocaml&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;share/atspre_staload.hats&amp;quot;&lt;br /&gt;
&lt;br /&gt;
dataprop FACT (int, int) =&lt;br /&gt;
  | FACTbas (0, 1) of () // basic case&lt;br /&gt;
  | {n:nat}{r:int}       // inductive case&lt;br /&gt;
    FACTind (n+1, (n+1)*r) of (FACT (n, r))&lt;br /&gt;
&lt;br /&gt;
(* note that int(x) , also int x, is the monovalued type of the int x value.&lt;br /&gt;
&lt;br /&gt;
 The function signature below says:&lt;br /&gt;
 forall n:nat, exists r:int where fact( num: int(n)) returns (FACT (n, r) | int(r)) *)&lt;br /&gt;
&lt;br /&gt;
fun fact{n:nat} .&amp;lt;n&amp;gt;. (n: int (n)) : [r:int] (FACT (n, r) | int(r)) =&lt;br /&gt;
(&lt;br /&gt;
  ifcase&lt;br /&gt;
  | n &amp;gt; 0 =&amp;gt; ((FACTind(pf1) | n * r1)) where &lt;br /&gt;
  { &lt;br /&gt;
    val (pf1 | r1) = fact (n-1)&lt;br /&gt;
  }&lt;br /&gt;
  | _(*else*) =&amp;gt; (FACTbas() | 1)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Part 2 (routines and test) ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ocaml&amp;quot;&amp;gt;&lt;br /&gt;
implement main0 (argc, argv) =&lt;br /&gt;
{&lt;br /&gt;
  val () = if (argc != 2) then prerrln! (&amp;quot;Usage: &amp;quot;, argv[0], &amp;quot; &amp;lt;integer&amp;gt;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  val () = assert (argc &amp;gt;= 2)&lt;br /&gt;
  val n0 = g0string2int (argv[1])&lt;br /&gt;
  val n0 = g1ofg0 (n0)&lt;br /&gt;
  val () = assert (n0 &amp;gt;= 0)&lt;br /&gt;
  val (_(*pf*) | res) = fact (n0)&lt;br /&gt;
&lt;br /&gt;
  val ((*void*)) = println! (&amp;quot;fact(&amp;quot;, n0, &amp;quot;) = &amp;quot;, res)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can all be added to a single file and compiled as follows. Compiling should work with various back end C compilers, e.g., [[GNU Compiler Collection]] (gcc). [[Garbage collection (computer science)|Garbage collection]] is not used unless explicitly stated with {{code|-D_ATS_GCATS}} )&amp;lt;ref&amp;gt;[http://www.ats-lang.org/TUTORIAL/contents/compilation.html Compilation - Garbage collection] {{webarchive |url=https://web.archive.org/web/20090804092735/http://www.ats-lang.org/TUTORIAL/contents/compilation.html |date=August 4, 2009}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
$ patscc fact1.dats -o fact1&lt;br /&gt;
$ ./fact1 4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
compiles and gives the expected result&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
=== Basic types ===&lt;br /&gt;
* bool (true, false)&lt;br /&gt;
* int (literals: 255, 0377, 0xFF), unary minus as ~ (as in [[ML (programming language)|ML]])&lt;br /&gt;
* double&lt;br /&gt;
* char &amp;#039;a&amp;#039;&lt;br /&gt;
* string &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Tuples and records ===&lt;br /&gt;
* prefix @ or none means direct, &amp;#039;&amp;#039;flat&amp;#039;&amp;#039; or unboxed allocation&lt;br /&gt;
*:&amp;lt;syntaxhighlight lang=&amp;quot;scala&amp;quot;&amp;gt;&lt;br /&gt;
  val x : @(int, char) = @(15, &amp;#039;c&amp;#039;)  // x.0 = 15 ; x.1 = &amp;#039;c&amp;#039;&lt;br /&gt;
  val @(a, b) = x                    // pattern matching binding, a= 15, b=&amp;#039;c&amp;#039;&lt;br /&gt;
  val x = @{first=15, second=&amp;#039;c&amp;#039;}    // x.first = 15&lt;br /&gt;
  val @{first=a, second=b} = x       // a= 15, b=&amp;#039;c&amp;#039;&lt;br /&gt;
  val @{second=b, ...} = x           // with omission, b=&amp;#039;c&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* prefix &amp;#039; means indirect or boxed allocation&lt;br /&gt;
*:&amp;lt;syntaxhighlight lang=&amp;quot;scala&amp;quot;&amp;gt;&lt;br /&gt;
  val x : &amp;#039;(int, char) = &amp;#039;(15, &amp;#039;c&amp;#039;)  // x.0 = 15 ; x.1 = &amp;#039;c&amp;#039;&lt;br /&gt;
  val &amp;#039;(a, b) = x                    // a= 15, b=&amp;#039;c&amp;#039;&lt;br /&gt;
  val x = &amp;#039;{first=15, second=&amp;#039;c&amp;#039;}    // x.first = 15&lt;br /&gt;
  val &amp;#039;{first=a, second=b} = x       // a= 15, b=&amp;#039;c&amp;#039;&lt;br /&gt;
  val &amp;#039;{second=b, ...} = x           // b=&amp;#039;c&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* special&lt;br /&gt;
*:With &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt; as separator, some functions return wrapped the result value with an evaluation of predicates&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;val&amp;#039;&amp;#039;&amp;#039; ( predicate_proofs | values) = myfunct params&lt;br /&gt;
&lt;br /&gt;
=== Common ===&lt;br /&gt;
 {...} universal quantification&lt;br /&gt;
 [...] existential quantification&lt;br /&gt;
 (...) parenthetical expression or tuple&lt;br /&gt;
 &lt;br /&gt;
 (... | ...)     (proofs | values)&lt;br /&gt;
&lt;br /&gt;
 .&amp;lt;...&amp;gt;. termination metric&lt;br /&gt;
 &lt;br /&gt;
 @(...)          flat tuple or [[variadic function]] parameters tuple (see example&amp;#039;s &amp;#039;&amp;#039;printf&amp;#039;&amp;#039;)&lt;br /&gt;
 &lt;br /&gt;
 @[byte][BUFLEN]     type of an array of BUFLEN values of type &amp;#039;&amp;#039;byte&amp;#039;&amp;#039;&amp;lt;ref&amp;gt;[http://www.ats-lang.org/DOCUMENTATION/MISC/manual_main.pdf#page=65 type of an array] {{webarchive |url=https://web.archive.org/web/20110904160146/http://www.ats-lang.org/DOCUMENTATION/MISC/manual_main.pdf#page=65 |date=September 4, 2011}} types like  @[T][I]&amp;lt;/ref&amp;gt;&lt;br /&gt;
 @[byte][BUFLEN]()   array instance&lt;br /&gt;
 @[byte][BUFLEN](0)  array initialized to 0&lt;br /&gt;
&lt;br /&gt;
=== Dictionary ===&lt;br /&gt;
{{Glossary begin}}&lt;br /&gt;
{{term|sort:domain}}&lt;br /&gt;
&amp;lt;dd&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 sortdef nat = {a: int | a &amp;gt;= 0 }     // from prelude: ∀ &amp;#039;&amp;#039;a&amp;#039;&amp;#039; ∈ int ...&lt;br /&gt;
&lt;br /&gt;
 typedef String = [a:nat] string(a)   // [..]: ∃ &amp;#039;&amp;#039;a&amp;#039;&amp;#039; ∈ nat ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/dd&amp;gt;&lt;br /&gt;
{{term|type (as sort)}}&amp;lt;dd&amp;gt;generic &amp;#039;&amp;#039;sort&amp;#039;&amp;#039; for elements with the length of a pointer word, to be used in type parameterized polymorphic functions. Also &amp;quot;boxed types&amp;quot;&amp;lt;ref name=&amp;quot;introdep&amp;quot;&amp;gt;{{Cite web |url=http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/c2232.html |title=Introduction to Dependent types |access-date=2016-02-13 |archive-url=https://web.archive.org/web/20160312024014/http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/c2232.html |archive-date=2016-03-12 |url-status=dead}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;scala&amp;quot;&amp;gt;&lt;br /&gt;
 // {..}: ∀ a,b ∈ type ...&lt;br /&gt;
 fun {a,b:type} swap_type_type (xy: @(a, b)): @(b, a) = (xy.1, xy.0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/dd&amp;gt;&lt;br /&gt;
{{term|t@ype}}{{defn| linear version of previous &amp;#039;&amp;#039;type&amp;#039;&amp;#039; with abstracted length. Also unboxed types.&amp;lt;ref name=&amp;quot;introdep&amp;quot;/&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{term|viewtype}}{{defn| a domain class like &amp;#039;&amp;#039;type&amp;#039;&amp;#039; with a &amp;#039;&amp;#039;view&amp;#039;&amp;#039; (memory association)}}&lt;br /&gt;
&lt;br /&gt;
{{term|viewt@ype}}{{defn| linear version of &amp;#039;&amp;#039;viewtype&amp;#039;&amp;#039; with abstracted length. It supersets &amp;#039;&amp;#039;viewtype&amp;#039;&amp;#039;}}&lt;br /&gt;
&lt;br /&gt;
{{term|view}}&amp;lt;dd&amp;gt;relation of a Type and a memory location. The infix {{mono|@}} is its most common constructor&lt;br /&gt;
:{{code|T @ L}} asserts that there is a view of type T at location L&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ocaml&amp;quot;&amp;gt;&lt;br /&gt;
 fun {a:t@ype} ptr_get0 {l:addr} (pf: a @ l | p: ptr l): @(a @ l | a)&lt;br /&gt;
 &lt;br /&gt;
 fun {a:t@ype} ptr_set0 {l:addr} (pf: a? @ l | p: ptr l, x: a): @(a @ l | void)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:the type of &amp;lt;code&amp;gt;ptr_get0 (T)&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;∀ l : addr . ( T @ l | ptr( l ) ) -&amp;gt; ( T @ l | T)    // see manual, section 7.1. Safe Memory Access through Pointers&amp;lt;/code&amp;gt;&amp;lt;ref&amp;gt;[http://www.ats-lang.org/htdocs-old/DOCUMENT/MISC/manual_main.pdff#page=61 Manual, section 7.1. Safe Memory Access through Pointers]{{dead link|date=October 2016 |bot=InternetArchiveBot |fix-attempted=yes}} (outdated)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ocaml&amp;quot;&amp;gt;&lt;br /&gt;
 viewdef array_v (a:viewt@ype, n:int, l: addr) = @[a][n] @ l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/dd&amp;gt;&lt;br /&gt;
{{term|T?}}{{defn|possibly uninitialized type}}&lt;br /&gt;
{{Glossary end}}&lt;br /&gt;
&lt;br /&gt;
=== pattern matching exhaustivity ===&lt;br /&gt;
as in &amp;#039;&amp;#039;&amp;#039;case+&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;val+&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;type+&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;viewtype+&amp;#039;&amp;#039;&amp;#039;, ...&lt;br /&gt;
&lt;br /&gt;
* with suffix &amp;#039;+&amp;#039; the compiler issues an error in case of non exhaustive alternatives&lt;br /&gt;
* without suffix the compiler issues a warning&lt;br /&gt;
* with &amp;#039;-&amp;#039;  as suffix, avoids exhaustivity control&lt;br /&gt;
&lt;br /&gt;
=== modules ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 staload &amp;quot;foo.sats&amp;quot; // foo.sats is loaded and then opened into the current namespace&lt;br /&gt;
&lt;br /&gt;
 staload F = &amp;quot;foo.sats&amp;quot; // to use identifiers qualified as $F.bar&lt;br /&gt;
&lt;br /&gt;
 dynload &amp;quot;foo.dats&amp;quot; // loaded dynamically at run-time&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== dataview ===&lt;br /&gt;
Dataviews are often declared to encode recursively defined relations on linear resources.&amp;lt;ref&amp;gt;[http://www.ats-lang.org/TUTORIAL/contents/dataviews.html Dataview construct] {{webarchive |url=https://web.archive.org/web/20100413053430/http://www.ats-lang.org/TUTORIAL/contents/dataviews.html |date=April 13, 2010}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ocaml&amp;quot;&amp;gt;&lt;br /&gt;
 dataview array_v (a: viewt@ype+, int, addr) =&lt;br /&gt;
   | {l: addr} array_v_none (a, 0, l)&lt;br /&gt;
   | {n: nat} {l: addr}&lt;br /&gt;
     array_v_some (a, n+1, l)&lt;br /&gt;
     of (a @ l, array_v (a, n, l+sizeof a))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== datatype / dataviewtype ===&lt;br /&gt;
Datatypes&amp;lt;ref&amp;gt;[http://www.ats-lang.org/TUTORIAL/contents/datatypes.html Datatype construct] {{webarchive |url=https://web.archive.org/web/20100414020420/http://www.ats-lang.org/TUTORIAL/contents/datatypes.html |date=April 14, 2010}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
 datatype workday = Mon | Tue | Wed | Thu | Fri&lt;br /&gt;
&lt;br /&gt;
lists&lt;br /&gt;
 &lt;br /&gt;
 datatype list0 (a:t@ype) = list0_cons (a) of (a, list0 a) | list0_nil (a)&lt;br /&gt;
&lt;br /&gt;
==== dataviewtype ====&lt;br /&gt;
A dataviewtype is similar to a datatype, but it is linear. With a dataviewtype, the programmer is allowed to explicitly free (or deallocate) in a safe manner the memory used for storing constructors associated with the dataviewtype.&amp;lt;ref&amp;gt;[https://github.com/githwxi/ATS-Postiats/wiki/dataviewtype Dataviewtype construct]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== variables ===&lt;br /&gt;
local variables&lt;br /&gt;
 var res: int with pf_res = 1   // introduces pf_res as an alias of &amp;#039;&amp;#039;view @ (res)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;on stack&amp;#039;&amp;#039; array allocation:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #define BUFLEN 10&lt;br /&gt;
 var !p_buf with pf_buf = @[byte][BUFLEN](0)    // pf_buf = @[byte][BUFLEN](0) @ p_buf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;ref&amp;gt;[http://www.ats-lang.org/htdocs-old/DOCUMENT/MISC/manual_main.pdf#page=64 Manual - 7.3 Memory allocation on stack] {{webarchive |url=https://web.archive.org/web/20140809193400/http://www.ats-lang.org/htdocs-old/DOCUMENT/MISC/manual_main.pdf#page=64 |date=August 9, 2014}} (outdated)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &amp;#039;&amp;#039;val&amp;#039;&amp;#039; and &amp;#039;&amp;#039;var&amp;#039;&amp;#039; declarations&amp;lt;ref&amp;gt;[http://www.ats-lang.org/htdocs-old/TUTORIAL/contents/val-and-var.html Val and Var declarations] {{webarchive |url=https://web.archive.org/web/20140809193101/http://www.ats-lang.org/htdocs-old/TUTORIAL/contents/val-and-var.html |date=August 9, 2014}} (outdated)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
{{Wikibooks|ATS: Programming with Theorem-Proving}}&lt;br /&gt;
* {{Official website|www.ats-lang.org}}&lt;br /&gt;
* [http://www.ats-lang.org/Documents.html The ATS Programming Language] {{Webarchive|url=https://web.archive.org/web/20141205101556/http://www.ats-lang.org/Documents.html |date=2014-12-05}} Documentation for ATS2&lt;br /&gt;
* [http://ats-lang.sourceforge.net/DOCUMENT/ The ATS Programming Language] Old documentation for ATS1&lt;br /&gt;
* [http://ats-lang.sourceforge.net/htdocs-old/DOCUMENT/MISC/manual_main.pdf Manual] Draft (outdated). Some examples refer to features or routines not present in the release (Anairiats-0.1.6) (e.g.: print overload for strbuf, and using its array examples gives errmsgs like &amp;quot;use of array subscription is not supported&amp;quot;.)&lt;br /&gt;
* [http://cs.likai.org/ats/ml-programmers-guide-to-ats ATS for ML programmers]&lt;br /&gt;
* [http://bluishcoder.co.nz/tags/ats/ Learning examples and short use‑cases of ATS]&lt;br /&gt;
&lt;br /&gt;
{{ML programming}}&lt;br /&gt;
&lt;br /&gt;
[[Category:High-level programming languages]]&lt;br /&gt;
[[Category:Multi-paradigm programming languages]]&lt;br /&gt;
[[Category:Declarative programming languages]]&lt;br /&gt;
[[Category:Functional languages]]&lt;br /&gt;
[[Category:Object-oriented programming languages]]&lt;br /&gt;
[[Category:ML programming language family]]&lt;br /&gt;
[[Category:OCaml programming language family]]&lt;br /&gt;
[[Category:Statically typed programming languages]]&lt;br /&gt;
[[Category:Dependently typed languages]]&lt;br /&gt;
[[Category:Systems programming languages]]&lt;br /&gt;
[[Category:Programming languages created in 2006]]&lt;br /&gt;
[[Category:Cross-platform free software]]&lt;br /&gt;
[[Category:Free and open source compilers]]&lt;br /&gt;
[[Category:Extensible syntax programming languages]]&lt;br /&gt;
[[Category:Software using the GNU General Public License]]&lt;br /&gt;
&amp;lt;!-- Hidden categories below --&amp;gt;&lt;br /&gt;
[[Category:Articles with example OCaml code]]&amp;lt;!-- Code example category family member nearest ATS. --&amp;gt;&lt;/div&gt;</summary>
		<author><name>80.71.133.84</name></author>
	</entry>
</feed>