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 (14:56)
From: Serge Aleynikov <serge@h...>
Subject: Re: [Caml-list] Scripting in ocaml
skaller wrote:
> On Thu, 2006-12-21 at 08:30 -0500, Serge Aleynikov wrote:
>> skaller wrote:
>>> As one of the authors of several major pieces of Python,
>>> my comment is that whilst it provides great convenience
>>> and good code structure .. dynamic typing just doesn't
>>> scale.
>> Could you please illustrate your point by more concrete reasoning. 
> It isn't a matter of reasoning but experience. Many people believe
> static typing is good because it improves the likelihood a program
> is correct, perhaps by making it easier for both the human and
> machine to reason about the code -- and in particular catch
> errors which would otherwise require testing, and even then
> the actual location of a bug might be hard to determine.

OCaml has static typing but doesn't provide an actual location of code 
in exceptions.  Is it because it was hard or intentional?

> I guess the arguments for static typing and scalability are
> well known. So the reasoning part is clear: we infer larger 
> programs without dynamic typing are harder to get right.

I agree with your statements applicable to imperative/OO dynamicly typed 
languages.  However if a dynamic language is functional, this makes it 
possible to provide run-time static analysis to identify type related 
bugs and unreachable code.  An example of this is the Dyalizer tool for 

In this case running such a tool after compilation reveals the same 
problems that a compile-level static checker would do, but allows for 
run-time code reloading, more safe term serialization/deserialization, 
and safer cross-language integration.  Needless to say, this benefits 
comes at price of efficiency, but there are many cases when these 
features out-weight a reasonable performance loss that can be regained 
by parallelizing computations.

> Sorry, I wasn't clear. I meant to refer to dynamic loading in Ocaml,
> not in general. Exactly why that is I don't know. Perhaps the
> interaction of the static typing and dynamic loading is not
> easy because it is not well understood how to make it so,
> in Ocaml, and perhaps in general (without losing type safety)

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.  ;-)