[clean-list] Comments on the module system

Brian Rogoff bpr@artisan.com
Fri, 26 Jul 2002 09:02:46 -0700


> Maks Verver <m.verver@student.utwente.nl> 
> On Tuesday 23 July 2002 18:12, Brian Rogoff wrote:
> >      In Clean 2, we don't need to repeat macro, type and class definitions
> > from the defition module in the implementation module, which is
> > nice. However, we still need to have an empty .icl if it is needed. It's a
> > petty complaint, but it would be nice if we could omit it.
> 
> Personally, I don't think it's all that useful to be able to omit macro, type
> and class definitions, when you still have to type over your (exported)
> function type definitions. 

What if you don't have exported function type definitions, and your module
consists solely of type information? I find that happens quite a bit in
other statically typed languages (I'm mostly thinking OCaml here) and I
suspect that it would happen in Clean too. 

> Writing definition files usually boils down to
> copy-pasting the implementation code (which can be tested perfectly from
> within a main module) and cutting out the implementation parts, or at least
> that's how it works for me. Also removing macro, type and class definitions
> from the implementation file only makes matters more complicated.
> 
> I don't like doing things that a machine could have done for me just as good
> (or in some cases even better), especially if I have to do them the exact
> same way every singly time I create a module (since you can't create anything
> but a main module without a definition file).  Also, whenever I decide to
> change a function definition, I have to modify both the implementation and
> declaration file.

OCaml has a tool to generate a .mli (.dcl) from a .ml (.icl), and you can
just edit that to omit things you don't want to export. This would probably
be a useful option to build into the Clean compiler too. 

I don't mind having separate implementation and interface files at all, and 
I think the comments for each are usually rather different, or should be. 
I take it from what you write later in this message that you agree, but
that you would prefer a module system more like that of Haskell where the 
interface and implementation are merged into one file. I actually like the 
way Clean does it now, but I'd like some minor convenience tweaks to reduce 
what I consider unhelpful redundancy. 

-- Brian