Filename Extensions


In ATS, we use the filename extensions ".sats" and ".dats" to indicate static and dynamic files, respectively. These two extensions have some special meaning attached to them and thus should not be replaced arbitrarily.

A static file may contain sort definitions, datasort declarations, static definitions, abstract type declarations, exception declarations, datatype declarations, macro definition, interfaces for dynamic values and functions, etc. In terms of functionality, a static file in ATS is similar to a header file (with the extension ".h") in C or an interface file (with the extension ".mli") in Objective Caml.

A dynamic file may contain everything in a static file. In addition, it may also contain defintions for dynamic values and functions.

In general, the syntax for constructing code in a static file can also be used for constructing code in a dynamic file. The only exception involves declaring interfaces for dynamic values and functions. For instance, in a static file, we can use the following syntax to declare interfaces (or types) for a value named pi and a function named area_of_circle.

val pi : double
fun area_of_circle (radius: double): double
When doing the same thing in a dynamic file, we need to use the following slightly different syntax:
extern val pi : double
extern fun area_of_circle (radius: double): double
where extern is a keyword in ATS.

As a convention, we often use the filename extension ".cats" to indicate that a file contains some C code that is supposed to be combined with ATS code in certain manner. However, the use of this filename extension is not mandatory.