[ocaml-platform] Changes to my previous proposal for namespaces

Leo White lpw25 at cam.ac.uk
Tue Mar 19 11:58:40 GMT 2013


>> So the lookup logic is:
>>
>>      name := Foo#Baz
>>      while there are more paths
>>          if !path is a directory then
>>              check for file named !name in !path
>>              if it found a file then
>>                  return the filename
>>          else !path is a file
>>              run "ocamldep -lookup !name !path"
>>              if it found a mapping
>>                  if mapping was a filename then
>>                      return the filename
>>                  else mapping was an alias
>>                      name := !alias
>
> So an alias in an .mlpath can only refer to a name defined in the directories and search path files that come strictly
> after the .mlpath file on the command-line?  I would have intuitively assumed that this would work the other way around
> (an alias would be interpreted in the current scope defined by previous -I directives).

Sorry, the above psuedo-code is supposed to be going backwards through
the paths.

> It's also unfortunate (assuming we really want aliases) that you cannot resolve an alias using other lines in the same
> .mlpath file (this means that passing several .mlpath files is not the same as passing a concatenation of those files).
> I could imagine Core coming with something like:
>
> Core#List: "core_list.cmi"
> Core_std#List: Core#List

That is allowed. It would be resolved by the "ocamldep -lookup" call, so
the build system would not need to be aware of it.


More information about the Platform mailing list