Version française
Home     About     Download     Resources     Contact us    
Browse thread
Module Abbreviations in MLI Files
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Module Abbreviations in MLI Files
From: "David McClain" <dmcclain1@mindspring.com>

> I'm a bit rusty writing raw OCaml from scratch, and I ran into syntax errors
> this morning whenever I tried to use Module abbreviations, such as
> 
> module T = Types
> 
> in my MLI files. These work just fine in ML files.
> 
> What is the reason for preventing type abbreviations in the interface spec?

There is no such thing as "module abbreviations".
The above is a module definition: it defines a module T, with the same
contents as module Types.
A module is a value, and you cannot define values in a signature, only
declare them.
If you have a signature Types_sig for Types, you might write
  module T : Types_sig
but then you would have to include an implementation in the module.

Jacques