caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] Modules and typing
@ 2002-04-30 13:44 Gregory Morrisett
  2002-04-30 23:57 ` John Max Skaller
  2002-05-02 12:31 ` Benedikt Grundmann
  0 siblings, 2 replies; 9+ messages in thread
From: Gregory Morrisett @ 2002-04-30 13:44 UTC (permalink / raw)
  To: Francois.Pottier, John Max Skaller; +Cc: caml-list

>  + require that abstract types are pointer types, as in 
> Modula-3 (?) and, more
>    recently, Cyclone

Actually, Cyclone has two different kinds of abstract types:
One abstracts pointer types (really, types that are compatible
with void*) and another kind that abstracts any type.  The latter
kind can only be used under a pointer.  I think this corresponds more 
closely to what Modula-3 provides with it's notion of "ref"
types.  

There's another option that you didn't mention which is the approach
taken by Ada:  Have a notion of "private" types in interfaces, e.g.

  type t
  [private t = int]

The client is type-checked with t treated abstractly, but the 
compiler can then specialize the client knowing what the implementation
of t is.  Of course, by leaking this information into the interface,
you're effectively losing separate compilation in the sense that
if the implementation of t changes, then its interface must also
change and all clients must then be (potentially) re-compiled.  But
this is a simple option which avoids some of the complexity that
you run into if you try to use abstract kinds to classify types
according to implementation details that a compiler might need
(e.g., size, calling-convention, and alignment constraints.)

-Greg

-------------------
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] 9+ messages in thread
* RE: [Caml-list] Modules and typing
@ 2002-05-02 19:27 Gurr, David (MED, self)
  0 siblings, 0 replies; 9+ messages in thread
From: Gurr, David (MED, self) @ 2002-05-02 19:27 UTC (permalink / raw)
  To: Benedikt Grundmann; +Cc: caml-list

Hi, the .cmx files generated by ocamlopt do some of
what you mention.  -D

> -----Original Message-----
> From: Benedikt Grundmann [mailto:bgrundmann@gmx.net]
> Sent: Thursday, May 02, 2002 5:31 AM
> To: Gregory Morrisett
> Cc: Francois.Pottier@inria.fr; skaller@ozemail.com.au;
> caml-list@inria.fr
> Subject: RE: [Caml-list] Modules and typing
> 
> 
> > >  + require that abstract types are pointer types, as in 
> > > Modula-3 (?) and, more
> > >    recently, Cyclone
> > 
> > Actually, Cyclone has two different kinds of abstract types:
> > One abstracts pointer types (really, types that are compatible
> > with void*) and another kind that abstracts any type.  The latter
> > kind can only be used under a pointer.  I think this 
> corresponds more 
> > closely to what Modula-3 provides with it's notion of "ref"
> > types.  
> > 
> > There's another option that you didn't mention which is the approach
> > taken by Ada:  Have a notion of "private" types in interfaces, e.g.
> > 
> >   type t
> >   [private t = int]
> > 
> > The client is type-checked with t treated abstractly, but the 
> > compiler can then specialize the client knowing what the 
> implementation
> > of t is.  Of course, by leaking this information into the interface,
> > you're effectively losing separate compilation in the sense that
> > if the implementation of t changes, then its interface must also
> > change and all clients must then be (potentially) re-compiled.  But
> > this is a simple option which avoids some of the complexity that
> > you run into if you try to use abstract kinds to classify types
> > according to implementation details that a compiler might need
> > (e.g., size, calling-convention, and alignment constraints.)
> > 
> > -Greg
> 
> Another option related to this is to generate a compiler only 
> interface file
> (maybe even binary).  Which contains everything the compiler 
> needs to know
> about the implementation of an interface.  Everything 
> mentioned above applies
> to this solution too, with the added benefit that a reader of 
> the interface
> can't make stupid assumptions about the implementation which 
> might not be true
> in the next release :-)
> 
> 
> Bene
> 
> -- 
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.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
-------------------
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] 9+ messages in thread
* Re: [Caml-list] Polymorphic Variants and Number Parameterized Typ es
@ 2002-04-29 13:35 Krishnaswami, Neel
  2002-04-29 14:16 ` [Caml-list] Polymorphic Variants and Number Parameterized Types Andreas Rossberg
  0 siblings, 1 reply; 9+ messages in thread
From: Krishnaswami, Neel @ 2002-04-29 13:35 UTC (permalink / raw)
  To: caml-list

Pascal Cuoq [mailto:pascal.cuoq@inria.fr] wrote:
> Neel Krishnaswami wrote:
> 
> > There's no recursion in the module system because that would break
> > the termination guarantee. If you think of modules as records, and
> > functors as lambda abstractions, you can see that the module system
> > defines a simply-typed lambda calculus. As you've noticed with C++, 
> > adding recursion to it would mean you can write nonterminating module
> > expressions. (All this is wonderfully clearly explained in 
> > the paper, "A modular  module system".)
> 
> I'm not sure about "simply-typed". Did the situation change since
> that of http://caml.inria.fr/archives/199907/msg00027.html ?

Wow! I didn't even know that was possible. I thought that typechecking
record subtyping was decidable...?

--
Neel Krishnaswami
neelk@cswcasa.com
-------------------
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] 9+ messages in thread

end of thread, other threads:[~2002-05-02 19:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-30 13:44 [Caml-list] Modules and typing Gregory Morrisett
2002-04-30 23:57 ` John Max Skaller
2002-05-02 12:31 ` Benedikt Grundmann
  -- strict thread matches above, loose matches on Subject: below --
2002-05-02 19:27 Gurr, David (MED, self)
2002-04-29 13:35 [Caml-list] Polymorphic Variants and Number Parameterized Typ es Krishnaswami, Neel
2002-04-29 14:16 ` [Caml-list] Polymorphic Variants and Number Parameterized Types Andreas Rossberg
2002-04-29 15:28   ` Francois Pottier
2002-04-30 10:04     ` [Caml-list] Modules and typing John Max Skaller
2002-04-30 11:51       ` Francois Pottier
2002-04-30 23:24         ` John Max Skaller
2002-05-01  8:08           ` Noel Welsh
2002-05-02  6:52             ` Francois Pottier

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).