[ocaml-platform] Unique file names

Yaron Minsky yminsky at janestreet.com
Tue Mar 5 14:06:21 GMT 2013


On Tue, Mar 5, 2013 at 5:10 AM, Alain Frisch <alain.frisch at lexifi.com> wrote:
> On 03/05/2013 03:48 AM, Yaron Minsky wrote:
>>
>> Could all of these benefits be obtained by having longer names for
>> files generated as part of the compilation (.cmx, .cmo, .cmi, etc.),
>> but keep the source file names short?  i.e., one could imagine that if
>> you put "-put-in-namespace core" on the command-line to ocamlc, it
>> would generate "core_list.ml" when given the file "list.ml".  The onus
>> would be on the build system to provide said flags, but it would seem
>> to simplify things thereupon.
>
>
> This would simplify the life of the library developer a little bit, but it
> would not really give the same benefits:
>
>  - If you get an error message (or an output from a tool, such as Bisect or
> a dead code detector) with a long name, it's more difficult to find the
> corresponding source file (e.g. to look the .mli file).
>
>  - You need to adapt all tools (ocamldep, ocamldoc and also third party
> tools), and this might change their interface (e.g. for ocamldoc, you will
> need to specify for each source file what's its implicit prefix).

I agree that this would have to be solved, though I think this is
worth doing.  You'd need some kind of lookup from the easy to find
file (e.g., core_list.cmi) to the hard-to-find file (list.ml).

But I think this is work worth doing.

>  - Generic rules (e.g. in Makefiles) are more difficult to write.

This doesn't seem like much of an issue, since you can feel free to
simply use unique file-names if you'd like to.  This is merely an
option for developers who want to organize things in this way.  In the
end, I think it won't matter most of the time, because I hope that as
we develop better build tools, they will handle this stuff
automatically.

But if people want, they can name things uniquely and use simple
Makefiles.

>  - You can deploy compiled files for several libraries in the same
> directory, but not the corresponding .mli files (for documentation purpose).

I think this is fairly poor practice.  Directory structures are useful
anyway, and one might as well encourage their use.

And again, the fully-qualified names would be available, if people
wanted to use them.  But I think OPAM should organize things into
directories, and keep the names of the files in those directories
short.

y


More information about the Platform mailing list