[ocaml-platform] An alternative proposal for namespaces

Leo White lpw25 at cam.ac.uk
Thu Mar 21 10:44:26 GMT 2013


>> As I have made clear, the build system shouldn't give ocamldep directories, it
>> should generate a search path file to represent the eventual contents of
>> those directories and give that file to ocamldep.
>
> It seems we converge.   You claim that build system should be responsible for generating search path files before
> calling ocamldep (and thus the compilers).  So do you agree that
> ocamldep does not need to support directories anymore?

The build system should generate a search path file for its local files
(i.e. the files it is responsible for building) if they may contain
generated source files. It should not have to create these files for all
of the packages that are being used. Neither should all packages have to
include a file listing the contents of their directories.

Ocamldep should still support directories for those people who do not
use generated source files. Again, having this support does not prevent
you from using ocamldep as you intend to.

> (except for backward compatibility of projects not using namespaces)  It seems that the "simple namespace" convention
> can be implemented entirely in the build systems, outside the core toolchain (compilers, ocamldep).  Fine, people can
> decide to use this convention, or another one, or write their search path files manually.  So let's keep this simple
> namespace convention outside the proposal.  Do you agree?

I do not agree. The build system generating a temporary file that the user
never sees is not the same as a file that the user must be aware of and
maintain.

Your proposal amounts to saying: rather than have the compiler call
Sys.readdir, we should force all packages to include a file listing the
contents of their directories. To me this seems bizarre, and certainly
not inline with keeping things simple.

It also complicates the proposal by merging the idea of namespaces with
the idea of search path files. The intention of my proposal was for a
group of simple independent extensions. Search path files are
independent of namespaces. They happen to work well with them but they
can be explained to a beginner completely independently. The same is true
of namespaces and the "-name" argument.

There is more to backward-compatibility than ensuring that all previous
programs compile. You should also preserve the modes of operation that
people have developed and become accustomed to. While looking files up
in directories has some flaws when combined with generated source files,
it is how OCaml has always operated (and how most programming languages
operate). To force people to switch away from that to a system based
entirely on search path files, even though most of them have no reason
to, is simply not good design.

We should not be looking to design the system that is the easiest for
the maintainers of omake, we should be looking to design the system that
is best for the users of OCaml. Adding support for "simple namespaces"
to omake will be a small amount of work one time, maintaining search
path files for all OCaml projects will be a pain indefinitely.


More information about the Platform mailing list