Browse thread
Wanted: your feedback on the hierarchy of OCaml Batteries Included
[
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: | 2008-11-18 (22:07) |
From: | Alain Frisch <alain@f...> |
Subject: | Re: [Caml-list] Wanted: your feedback on the hierarchy of OCaml Batteries Included |
On 11/18/2008 7:17 PM, Jon Harrop wrote: > I don't follow. Can you not use "include" to extend an existing module: > > # module Array = struct > include Array > let empty = [||] > end;; > module Array : > sig > external length : 'a array -> int = "%array_length" > ... > val empty : 'a array > end In addition to this being non-modular, this extension scheme does not work well with hiararchy as it forces you to mention all the siblings of the ancestors of the module you want to extend. E.g. if you start from: module M = struct module M1 = struct module M11 = struct ... end module M12 = struct ... end module M13 = struct ... end ... end module M2 = struct ... end module M3 = struct ... end ... end and you want to extend M11, you need to write: module M' = struct module M1 = struct module M11 = struct include M.M1.M11 (* extension here *) end module M12 = M.M1.M12 module M13 = M.M1.M13 ... end module M2 = M.M2 module M3 = M.M3 ... end Frankly, I don't think that having a nice and well-organized hierarchy of modules really matters. Things like having uniform interfaces, consistent idioms and compatible types across libraries seem much more important to me. Anyway, if a hierarchy is desired, I fail to see any advantage of using "." instead of e.g. "_" (easily extensible + does not force you to link everything). -- Alain