caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Do you like files as modules?
@ 2004-10-07  3:12 skaller
  2004-10-07  5:38 ` Matt Gushee
  2004-10-07 19:45 ` [Caml-list] " William Lovas
  0 siblings, 2 replies; 4+ messages in thread
From: skaller @ 2004-10-07  3:12 UTC (permalink / raw)
  To: caml-list

I am seeking your feelings and comments on the following issue.
Many programming languages, including Python and Ocaml,
but excluding C and C++, have a concept of a module
such that translation units are also modules.

In both Ocaml and Python, the module name is also
coupled to the filename.

Which technique do you prefer? Why? What advantages
and disadvantages does each have? How is the 
compiler architectural model coupled to program
semantics, optimisation, separate compilation,
and linkage, and should it be?


-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Do you like files as modules?
  2004-10-07  3:12 [Caml-list] Do you like files as modules? skaller
@ 2004-10-07  5:38 ` Matt Gushee
  2004-10-07 16:14   ` [Caml-list] " Stefan Monnier
  2004-10-07 19:45 ` [Caml-list] " William Lovas
  1 sibling, 1 reply; 4+ messages in thread
From: Matt Gushee @ 2004-10-07  5:38 UTC (permalink / raw)
  To: caml-list

On Thu, Oct 07, 2004 at 01:12:46PM +1000, skaller wrote:
> 
> In both Ocaml and Python, the module name is also
> coupled to the filename.

This doesn't bother me, but it would be nice if the compilers had an
option allowing you to associate differently-named interface and
implementation files. Currently, if you have an interface 'foo.mli',
with several possible implementations, you have to resort to kludges
like creating subdirectories a/, b/, and c/, each with a different
version of 'foo.ml', one of which gets copied into the main directory at
build time. It should be possible to have foo_a.ml, foo_b.ml, and
foo_c.ml, and arbitrarily select one as the implementation of Foo.

-- 
Matt Gushee                 When a nation follows the Way,
Haven Rock Press            Horses bear manure through
Englewood, Colorado, USA        its fields;   
books@havenrock.com         When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Caml-list] Re: Do you like files as modules?
  2004-10-07  5:38 ` Matt Gushee
@ 2004-10-07 16:14   ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2004-10-07 16:14 UTC (permalink / raw)
  To: caml-list

> implementation files. Currently, if you have an interface 'foo.mli',
> with several possible implementations, you have to resort to kludges
> like creating subdirectories a/, b/, and c/, each with a different
> version of 'foo.ml', one of which gets copied into the main directory at

I thought the way to deal with that was to explicitly define a module A of
signature Foo in the file foo_a.ml, module B : Foo in file foo_b.ml, ...
Or something like that.


        Stefan

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Do you like files as modules?
  2004-10-07  3:12 [Caml-list] Do you like files as modules? skaller
  2004-10-07  5:38 ` Matt Gushee
@ 2004-10-07 19:45 ` William Lovas
  1 sibling, 0 replies; 4+ messages in thread
From: William Lovas @ 2004-10-07 19:45 UTC (permalink / raw)
  To: caml-list

On Thu, Oct 07, 2004 at 01:12:46PM +1000, skaller wrote:
> In both Ocaml and Python, the module name is also
> coupled to the filename.
> 
> Which technique do you prefer? Why? What advantages
> and disadvantages does each have?

Some people say that it's a misstep to couple the programs semantics with
that of the operating system's filesystem.  Personally, however, i like
being able to tell which file a function is defined in while i'm reading
someone else's source code.  Conventions go a long way, but language
restrictions can't be ignored.

Unfortunately, module *types* are not treated the same way, so you're
forced to refer to things like Map.S and whatnot..

> How is the 
> compiler architectural model coupled to program
> semantics, optimisation, separate compilation,
> and linkage, and should it be?

This is a tough question, i think, and I like the way the O'Caml folks have
answered it.  Standard ML gets around this question by *not* answering it,
so every compiler implementation has its own idea of how to do things.
This makes it hard (impossible?) to write Standard ML programs that build
uniformly under any implementation of the language.  (In some degenerate
sense, i suppose the same is true of O'Caml, though, since it has only one
implementation.)

cheers,
William

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-07 19:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-07  3:12 [Caml-list] Do you like files as modules? skaller
2004-10-07  5:38 ` Matt Gushee
2004-10-07 16:14   ` [Caml-list] " Stefan Monnier
2004-10-07 19:45 ` [Caml-list] " William Lovas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).