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
OO programming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Edgar Friendly <thelema314@g...>
Subject: Re: [Caml-list] OO programming
Tiphaine.Turpin wrote:
>>  or they are required by the GUI
>> layer), and that OCaml has now way to seperate method/function
>> declaration and type declaration (unless one uses a mli file, which is
>> again inconvenient because it splits information that belongs together
>> into two complete different places). I'd really appreciate it if one
>> could just mix "val" type declcarations with "let" or "method" code
>> declarations.
> I don't understand what you want here.

I read him as asking for .ml files to contain what .mli files now
contain - i.e. method/function declarations

Example -

val init: int -> (int -> char) -> string

let init n f =
  let s = make n (f 0) in
  for i=1 to n-1 do
    set s i (f i);

OCaml doesn't permit this at the moment because val statements go in
.mli files (or in sig blocks) only.