Version française
Home     About     Download     Resources     Contact us    
Browse thread
Unimplemented modules as top-level signatures
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lauri Alanko <la@i...>
Subject: Unimplemented modules as top-level signatures
A minor annoyance in OCaml is that although you can (and must) put
each top-level module into its own file, there is no corresponding
mechanism for defining module types on their own: you always have to
put a "module type" definition inside another module, which
complicates scoping, and with standard tools adds an extra level of
indentation to the signature definition.

However, with 3.12 there is solution of sorts: write the signature
definition in foo.mli without an accompanying foo.ml, and then refer
to the signature as "module type of Foo".

Is this horrible style? Are there some pitfalls I should be aware of?
Or are there better solutions to my desire to avoid nested scoping?
Top-level functors would also be nice to have... :)


Lauri Alanko
la@iki.fi