Version française
Home     About     Download     Resources     Contact us    

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

Browse thread
OO programming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-28 (13:30)
From: Andrej Bauer <Andrej.Bauer@f...>
Subject: Re: [Caml-list] OO programming
Keiko Nakata wrote:
>>> As for extension, I'm fully satisfied. But the verbosity level is 
>>> annoying for scalability...
>> Well, yes, that's always the problem with functors...
> Since there are some people (including me) 
> who are interested in using functors and recursive modules 
> in the style of object-oriented context, 
> I thought that it could be useful to devise 
> a (camlp4) syntax extension which mitigates this a bit painful verbosity. 
> At the moment, I have no idea which syntax is general enough and intuitive for us,
> but as far as I understand we always follow similar encodings. 

I have three wishes related to the case when a functor accepts a 
structure that contains a single type or a single value:

1) To be able to write

   module F(type t) = struct ...t... end

instead of

   module F(T : sig type t end) = struct ... T.t  ... end

and to write


instead of

   F(struct type t = s end)

2) Similarly for values, to be able to write

   module F(val x : t) = struct ... x ... end

instead of

   module F(T : sig val x : t end) = struct ... T.x ... end

3) Similarly for signatures:

   module type F = functor type t -> sig ... end

   module type F = functor val x : t -> sig ... end

I believe these are campl4 trivialities. There may be some hoxus-pocus 
related to generating suitable names for T's above.