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
Scripting in ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-12-21 (21:11)
From: Serge Aleynikov <serge@h...>
Subject: Re: [Caml-list] Scripting in ocaml
Chad Perrin wrote:
 > On Thu, Dec 21, 2006 at 09:59:15AM -0500, Serge Aleynikov wrote:
 >> I believe that introducing strict typing in the language might help in
 >> bridging static typing and dynamic loading.  Strict typing would allow
 >> to do run-time type verification and type-specific guard checks.
 >> Though, this would no longer be Ocaml as we know it today.  ;-)
 > I think you lost me.  What do you mean by "strict typing" such that
 > OCaml doesn't do it?  From what I've seen, OCaml is both statically and
 > strongly typed.

What I meant by "strict typing" was performing type checks *at runtime*, 
i.e. that there are no unsafe operations.

Say, as an example, doing type checks of function arguments at runtime:

let f = fun i when is_integer (i) -> i
           | x when is_float   (x) -> int_of_float x;;

(raising Bad_match of some sort if neither one of the two guards pass)

Direct application of this could be for making the Marshal/Unmarshal 
modules more safe when marshaling data over files/sockets between 
applications written in heterogeneous languages.


Serge Aleynikov
Routing R&D, IDT Telecom
Tel: +1 (973) 438-3436
Fax: +1 (973) 438-1464