Browse thread
OO programming
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Keiko Nakata <keiko@k...> |
| Subject: | Re: [Caml-list] OO programming |
> 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 > > F(s) > > 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. This is merely my personal preference, but I usually do not prefer implicit construction of names; for instance I may well get confused by type error messages. Besides in this scenario: > module F(type t) = struct ...t... end we need to decide which take precedence if the structure declares a type component named t. On the other hand, since the functor parameter has the role of the super class in the functor&fix-point approach to OO-style programming, it may well be useful to have an implicit way to refer to components of the parameter, as you proposed. Yet this may be confusing again if we consider multi-parameter functors a la multiple inheritance. What do you think? With best regards, Keiko