Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] language-based permissions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-12-08 (05:12)
From: Josh Burdick <jburdick@g...>
Subject: [Caml-list] language-based permissions?
    I noticed that as of OCaml 3.05, there was a new option, 
"-nostdlib".  It seems superficially like with this, and the 
"-nopervasives" option, you could do language-based security (as in the 
MMM web browser of yore, Java, and Perl's Safe module, among many others.)
    In the attached three files, it seems like "" should only be 
allowed to see, and use, the primitives in "" (which aren't 
much; this is a toy example.)  If "" tries to use anything else 
(as in the commented-out "print_string" line), it gets "Unbound value" 
errors in compiling, and can't.
    My question: could "" call other primitives somehow, even 
though they're not linked in?  Using the preprocessor, or "external" 
functions", maybe?  (Assuming that you don't use the  "-unsafe" option, 
of course...)

    Josh Burdick

==> <==
open Pervasives
let (+) = (+)
let print_int = print_int
==> <==
open Fileworld
let _ =
(*  print_string "test\n" *)
  print_int (2+2)
==> <==
ocamlc -c
# now, this should only allow primitives in to be used...
ocamlc -c -nopervasives -nostdlib
# to build the final object, need to allow Pervasives to be linked in
ocamlc fileworld.cmo foo.cmo

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: