OCaml

OCaml is the actively developed member of the ML family, with an evolution from ML to CAML [2 ] based on the categorial abstract machine (Hindley-Milner), then Objective Caml [1 ].

It is a strict functional programming language of ML family, supporting also imperative programming. It features first class modules (Modules as values), polymorphic typing with type inference, generalized algebraic data types and has a pretty wide set of libraries and tools. Also, it is simple and fast, with a quite succinct expressive syntax. The code can be compiled to bytecode, to machine code, or it can be used like a scripting language with direct compilation to byte code.

And one can note, that it can use Tk for GUIs (labltk module).

Given that Ocaml can be used to create share libraries [3 ], just like C, it should not be that difficult to use with Tcl - in the classic Tcl as glue for another language fashion.


schlenk It is not too difficult to wrap an OCaml library as a Tcl extension, but there are some small issue one has to be aware off.

  * The library should be created as native code, not OCaml Bytecode.
  * When trying to bridge OCaml Objects to Tcl_Obj representations on needs to be aware of differences 
    like the CAR/CON semantics of OCaml lists vs. the C array style reps of Tcl_ListObj, so you need
    to study the boxing/unboxing of OCaml Values to make it work, e.g. recursive creation of OCaml lists
    from Tcl_ListObj.
    Its easier to work via the String interfaces.

NML is a dynamically typed functional language. It supports overloaded, vectorized, math operations, list comprehensions, and optional and keyword arguments in uncurried argument tuples, possibly with specified default values. It includes a Tcl/Tk interactive browser and interaction window with list pane access to a user modifiable documentation database.

NML compiles its source code to fast closures of native OCaml code.

http://home.mindspring.com/~dmcclain1/Image9.gif