Filename Extensions

In ATS, the filename extensions .sats and .dats are reserved to indicate static and dynamic files, respectively. As these two extensions have some special meaning attached to them, which can be interpreted by the command atscc, they 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 OCaml.

A dynamic file may contain everything in a static file. In addition, it may also contain defintions for dynamic values and functions. However, interfaces for functions and values in a dynamic file should follow the keyword extern, which on the other hand should not be present when such interfaces are declared in a static file. For instance, the following syntax declares interfaces in a static file (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 the same interfaces are declared in a dynamic file, the following slighly different syntax should be used:

extern val pi : double
extern fun area_of_circle (radius: double): double

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. There is also the filename extension .hats, which we occassionally use for a file that should be included in ATS code stored in another file. However, the use of these two filename extensions are not mandatory, that is, they can be replaced if needed or wanted.