This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

Questions concerning modules as first-class values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2010-06-02 (13:15) From: Dario Teixeira Subject: Questions concerning modules as first-class values
```Hi,

3.12 will bring modules as first-class values to the Ocaml language.
This is an interesting development whose full range of applications will
surprise us for many years, I suspect.  It also raises a few questions,
two of which I'll throw to the audience.

The first is purely one of terminology.  The table below describes how up
until now core "elements" of the Ocaml language could be described; note the
use of ad-hoc terms such as "value-ish", "module-ish", and even "elements".
Moreover, since modules are now also first-class "values", the terminology
is bound to get confusing.  So, what should the proper names for all these
"elements" be?

-------------------------------------------------
|               | 0-arity       | n-arity (n>0) |
-------------------------------------------------
| Valueish      | value         | function      |
|               |               |               |
| Moduleish     | module        | functor       |
-------------------------------------------------

Second, does the promotion of modules to first-class values also extend to
higher-order modules, ie, functors?  For the sake of symmetry I reckon it
ought to.  As an illustration, consider again the same table, but extended to
a third dimension indicating with a boolean (T or F) whether each "element"
is a first-class "value" (the third dimension is represented after a slash).
It seems right that the question mark in the functor cell should also be a "T".
But is it?

-------------------------------------------------
|               | 0-arity       | n-arity (n>0) |
-------------------------------------------------
| Valueish      | value/T       | function/T    |
|               |               |               |
| Moduleish     | module/T      | functor/?     |
-------------------------------------------------