caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] language-based permissions?
@ 2003-12-08  5:12 Josh Burdick
  2003-12-08  5:39 ` Nicolas Cannasse
  0 siblings, 1 reply; 2+ messages in thread
From: Josh Burdick @ 2003-12-08  5:12 UTC (permalink / raw)
  To: caml-list

    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 "foo.ml" should only be 
allowed to see, and use, the primitives in "fileworld.ml" (which aren't 
much; this is a toy example.)  If "foo.ml" 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 "foo.ml" 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...)

    Thanks,
    Josh Burdick
    jburdick@gradient.cis.upenn.edu

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


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-08  5:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-08  5:12 [Caml-list] language-based permissions? Josh Burdick
2003-12-08  5:39 ` Nicolas Cannasse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).