module thinning in Caml 1.06

From: Scott Alexander (
Date: Thu Dec 04 1997 - 21:10:18 MET

Message-Id: <>
Subject: module thinning in Caml 1.06
Date: Thu, 04 Dec 1997 15:10:18 EST
From: Scott Alexander <>

For my active networks work, I'm using Dynlink to dynamically load modules. In
the same way as MMM, I'm using module thinning to ensure that loaded modules
cannot do "bad" things. Thus, I have a Safeunix.mli which is a very heavily
thinned version of Unix.mli. (It is, of course, derived from the MMM module
of the same name.) In Caml 1.05, I was able to say:

type sockaddr = Unix.sockaddr =
    ADDR_UNIX of string
  | ADDR_INET of inet_addr * int
  | ADDR_PKT of int * string * int

which gave me a type Safeunix.sockaddr. With this, I was able to define
a function which returned the return value from Unix.sendto (a
Unix.sockaddr) and call it a Safeunix.sockaddr.

Under 1.05, if I then compiled a module which opens Safeunix, Safeunix
would be in its list of required interfaces (as reported by objinfo),
but Unix would not. Under 1.06, Unix is now a required interface, so I
am unable to link. Is there a way around this short of writing a
function to convert the types that I can get my code working again with
1.06. (It seems unnecessarily inefficient to run the conversion function
for each call.)

Scott Alexander

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:13 MET