Version française
Home     About     Download     Resources     Contact us    
Browse thread
Parameterized signatures needed ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Parameterized signatures needed ?
> In view of the
> solutions which exist at the level of expressions, one may suggest
> extending O'Caml with
> 
>  * either explicit sub-signature constraints, e.g.
> 
>    module d(X:sig
> 		 module type B < sig type t end
> 		 module F(a:A) : sig
> 		     module b:B
> 		     module c:C with type t = b.t
> 		   end
> 	       end) : ...

It looks like this would fit quite naturally within the OCaml module
system.  After all, the module language is explicitely typed, has
subtyping and a form of parametric polymorphism; bounded polymorphism
is the next step.  (I haven't checked the details, though.)

>  * or row variables in signatures, although I am not sure which form
>    this would take.

This looks less natural to me.  A very limited form of "row
polymorphism" can already be expressed with module type parameters and
sub-structures, as in:

    module d(X:sig
                 module type X
 		 module F(a:A) : sig
 		     module b: sig type t  module M: X end
 		     module c:C with type t = b.t
 		   end
 	       end) : ...

but it's very limited and not really practical.

- Xavier Leroy