Re: Undefined labels

From: Markus Mottl (mottl@miss.wu-wien.ac.at)
Date: Fri Nov 19 1999 - 17:18:53 MET


From: Markus Mottl <mottl@miss.wu-wien.ac.at>
Message-Id: <199911191618.RAA04547@miss.wu-wien.ac.at>
Subject: Re: Undefined labels
To: caml-list@davidb.org (David Brown)
Date: Fri, 19 Nov 1999 17:18:53 +0100 (MET)
In-Reply-To: <14388.23744.409028.106149@opus.davidb.org> from "David Brown" at Nov 18, 99 12:08:32 pm

> 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...

Regards,
Markus Mottl

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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:28 MET