Which languages use “paired” header/implementation files

file structureheadersprogramming-languages

C is ubiquitous, and C++ nearly as much, but I'm curious which other languages follow a similar model of header files. Specifically, in which other languages is it idiomatic to edit pairs or groups of "header" and "implementation" files? (A group as in multiple headers with one corresponding implementation file or a single header with multiple implementation files, as also seen in C.) For example, the pair "blah.h" and "blah.c".

C's header files are tied into the C preprocessor, but that's not the detail I'm focusing on here. For example, PHP has various include mechanisms, but you don't have a pair/group of "blah-header.php" plus "blah-notheader.php".

Some languages generate a file from source in a one-to-one mapping, such as Java, but that's not what I'm talking about either. I'm interested in cases where the programmer directly edits both/all files in the pair/group.

Perhaps to put it another way: which languages have a declaration file ("header") and definition file ("implementation") such that a person would generally edit both files in tandem?

Best Answer

Ada

Any Ada package on the other hand consists of two parts, the specification (header) and body (code). The specification however is a completely stand alone entity which can be compiled on its own and so must include specifications from other packages to do so. An Ada package body at compile time must refer to its package specification to ensure legal declarations, but in many Ada environments it would look up a compiled version of the specification.

--file example.ads, the package specification.
package example is
:
:
end example;

--file example.adb, the package body.
package body example is
:
:
end example;

Source: http://www.adahome.com/ammo/cpp2ada.html#2

Related Topic