Version française
Home     About     Download     Resources     Contact us    
Browse thread
module thinning in Caml 1.06
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Scott Alexander <salex@d...>
Subject: module thinning in Caml 1.06
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.)

Thanks,
Scott Alexander
salex@dsl.cis.upenn.edu