Loading ...
Sorry, an error occurred while loading the content.

3294Re: "ocaml_beginners"::[] Modules

Expand Messages
  • Oliver Bandel
    May 2, 2005

      On Sun, May 01, 2005 at 12:05:57PM -0600, Matt Gushee wrote:
      > jonboy3182 wrote:
      > > How do I have multiple implementations of a module use one interface
      > > (without using Objects). For instance:
      > >
      > > Interface: Tree
      > > Implementations: BinaryTree, AvlTree, RedBlackTree, AATree
      > Well, a couple of others have given good answers, so I won't repeat what
      > they said. You should know, however, that when you are using implicit
      > interfaces and implementations (i.e. the module is inferred from the
      > .ml/.mli file, rather than defined with the 'module' keyword), you don't
      > get to choose which is bound to which. I.e., if you had 'tree.mli' and
      > 'binarytree.ml', etc. You would have to copy 'binarytree.ml' to
      > 'tree.ml' in order to bind it to the 'tree.mli' interface. This is
      > unfortunate, but it seems that it would be difficult to allow
      > flexibility in matching .ml and .mli compilation units.

      Well, there is an "include" for signature, but not
      for structures.

      Wouldn't it make sense to have something like that?

      Include_struct "tree.ml"
      Include_file "tree.ml"


    • Show all 17 messages in this topic