English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2005-12-06 (23:29)
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.