Article View: comp.lang.misc
Article #663Re: Header files
From: Nick Rothwell
Date: Thu, 28 Sep 1989 11:07
Date: Thu, 28 Sep 1989 11:07
49 lines
2078 bytes
2078 bytes
In article <24955@louie.udel.EDU>, new@udel writes:
>One thing I have always liked about the C language was the separation
>between the "header" files (.h) and the "code" files (.c).
>Does anyone know of any relatively popular languages that allow this
>sort of separation other than C and C++? If not, why not?
Discussion?
ML can do the same sort of thing:
signature SMALL_PART =
sig
type ... and ... and ...
val ... : ty1 and ... : ty2 and ...
end;
signature ANOTHER_SMALL_PART = ...
signature ENTIRE_THING =
sig
include SMALL_PART
include ANOTHER_SMALL_PART
end
This gives you inclusion of interfaces. There's also nesting of
interfaces; the ENTIRE_THING signature could specify two sub-modules
with smaller signatures. The actual module to match ENTIRE_THING could
be a single object containing all the type specs and functions, or
could be built from two (or more) separate ones:
functor EntireThing(structure Part1: SMALL_PART
structure Part2: ANOTHER_SMALL_PART
) =
struct
open Part1 (* simple case: inclusion. *)
open Part2
end;
You can also have several implementations maching the same interface
of course (but you said you weren't interested in that).
> -- Darren
Nick.
--
Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh.
nick@lfcs.ed.ac.uk <Atlantic Ocean>!mcvax!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
Fais que ton reve soit plus long que la nuit.
Technical Details
Message-ID:
<512@castle.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!uunet!mcsun!ukc!edcastle!lfcs!nickReferences:
<24955@louie.udel.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!uunet!mcsun!ukc!edcastle!lfcs!nick From: nick@lfcs.ed.ac.uk (Nick Rothwell) Newsgroups: comp.lang.misc Subject: Re: Header files Message-ID: <512@castle.ed.ac.uk> Date: 28 Sep 89 11:07:57 GMT References: <24955@louie.udel.EDU> Sender: root@castle.ed.ac.uk Reply-To: nick@lfcs.ed.ac.uk (Nick Rothwell) Organization: LFCS Enya Admiration Society Lines: 49 In-reply-to: new@udel.EDU