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
Re: Undefined labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-11-19 (18:17)
From: Markus Mottl <mottl@m...>
Subject: Re: Undefined labels
> I'm not familiar with the parser too much, but perhaps something like:
> open (bleep, bloop, SubMod) Module;;

I think there is not really a big difference to:

  let bleep = Module.bleep
  let bloop = Module.bloop
  module SubMod = Module.SubMod

The typing effort is nearly neglectible, especially if you use a convenient
editor. It also may make things clearer. In fact, your proposal would be
ambiguous, because it is not clear whether "bleep" is a function or a type
(different name spaces!).

> There probably should also be a way to open all of the constructors of
> a type.

Now this would not be so bad an idea, because often such types may have
quite many constructors and in general you need all of them at once.

Unfortunately, e.g.

  module M = struct type t = A | B end

  type u = M.t

will not do this for you.

What problems could arise if the semantics of "type" were changed to allow
"importing" constructors like this? - It looks pretty harmless at first
sight and would fit to the style of abbreviations used above...

Markus Mottl

Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl