[ocaml-platform] on the need and design of OCaml namespaces

Daniel Bünzli daniel.buenzli at erratique.ch
Tue Feb 26 16:30:46 GMT 2013


Le mardi, 26 février 2013 à 17:00, Yaron Minsky a écrit :
> I think you're underselling the importance of keeping names concise.
> We've started using Garrigue's short-paths patch, and it is amazing
> how much it helps error messages, and the key thing it does is remove
> unnecessary qualifications. OCaml's error messages aren't great as
> they are, and making them even longer is a bug user-interface mistake.

This is also something that's very important to me. Beyond one (maybe two) "dot" levels I find things to become unreadable, especially when printed as a part of aggregate types like tuples or polymorphic variants.

It was also that reason that prompted me to design the Gg's module mentioned before as it is, i.e. if you take care to define your module signatures as follows:

type a
module A : sig
  type t = a
 (* mention a not t in the signatures *)
  val create : unit -> a  
  val op : a -> a
end

They are still compatible with the M.t convention for functors but you get short Cunit.a type names in errors and your definitions.  

Daniel




More information about the Platform mailing list