Browse thread
OO programming
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Berke Durak <berke.durak@e...> |
| Subject: | Re: [Caml-list] OO programming |
Edgar Friendly a écrit :
> 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 - string_annex.ml:
>
> 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);
> done;
> s
>
>
> OCaml doesn't permit this at the moment because val statements go in
> .mli files (or in sig blocks) only.
>
Yes that could be nice but it's no biggie IMHO.
let init n f =
let s = make n (f 0) in
for i=1 to n-1 do
set s i (f i);
done;
s
let init : int -> (int -> char) -> string = init
--
Berke DURAK