caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: first class, recursive, mixin modules (was: RE: first class m odules)
@ 2001-02-09  9:41 Claudio Russo
  2001-02-09 16:47 ` Brian Rogoff
  2001-02-09 21:45 ` William Chesters
  0 siblings, 2 replies; 8+ messages in thread
From: Claudio Russo @ 2001-02-09  9:41 UTC (permalink / raw)
  To: Brian Rogoff, caml-list

> On Fri, 12 Jan 2001, Claudio Russo wrote:
> > I wasn't quite sure of your intention, but I did get the 
> attached code
> > to work in Mosml (it includes a port of the Ocaml libraries and a
> > fleshed out implementation of your idea).
> 
> Cool! OK, now Alain has at least one example of a practically 
> useful case
> handled by your scheme :-). I suspect that this problem bites 
> lots of ML 
> programmers, and a fix is eagerly desired by at least two OCaml
> programmers. Congratulations on making this work, the millenium is
> starting off on a great note already!

I'm not really sure it bites that many, but I'd like to be told
otherwise. It does really hit you when  trying to 
implement Chris Okasakis elegant bootstrapped data structures, or
emulate object oriented things with modules.  (Together with first-class
and recursive structure, you can model quite a bit of object oriented
stuff, but I'm not sure how natural or efficient this appproach is.) 
 
> > Unfortunately, this only works in an internal release of 
> Moscow, because
> > of a (known) bug in the current distribution. 
> 
> Well, even more unfortunately, a fix in Mosml doesn't help me 
> unless you
> change to Mosocaml. I couldn't switch to SML even if I wanted 
> to, and I 
> don't want to! Hopefully the OCaml Implementors (you guys are even
> capitalized now) will "borrow back" the Mosml improvements 
> into OCaml. 

If I had the time, I'd do it, but I don't really. It should be easy to
deconstruct the Moscow ML sources
and transplant the ideas to Ocaml (at least to the bytecode
interpreter). I can give pointers to whoever tries to do that.


Cheers,
Claudio

> 



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

* RE: first class, recursive, mixin modules (was: RE: first class m  odules)
  2001-02-09  9:41 first class, recursive, mixin modules (was: RE: first class m odules) Claudio Russo
@ 2001-02-09 16:47 ` Brian Rogoff
  2001-02-09 21:45 ` William Chesters
  1 sibling, 0 replies; 8+ messages in thread
From: Brian Rogoff @ 2001-02-09 16:47 UTC (permalink / raw)
  To: Claudio Russo; +Cc: caml-list

On Fri, 9 Feb 2001, Claudio Russo wrote:
> > Cool! OK, now Alain has at least one example of a practically 
> > useful case
> > handled by your scheme :-). I suspect that this problem bites 
> > lots of ML 
> > programmers, and a fix is eagerly desired by at least two OCaml
> > programmers. Congratulations on making this work, the millenium is
> > starting off on a great note already!
> 
> I'm not really sure it bites that many, but I'd like to be told
> otherwise.

I'd be very surprised if it hasn't bitten a very large fraction of people 
who've used ML seriously for any length of time. I actually presented a 
sort of "solution" in Mosml using recursive modules but the problem is 
that of wanting a recursion between a type declaration and a functor 
instantiation. I've actually noticed quite a few mails from programmers on
this topic. 

> It does really hit you when trying to implement Chris Okasakis elegant 
> bootstrapped data structures, or emulate object oriented things with 
> modules.

It's close to something OO, the "Composite" pattern, but it is not a 
particularly OO concept. Many hierarchical structures have a leaf/hier 
relationship and as soon as you try to reuse the Set functor or 
a signature in the type definition of the composite you get slapped. 

In the faux-ML code I wrote, you could switch representations of the 
collection with a single line change. It is a bit verbose, but I 
prefer it to the parameterization trick, which requires that I change 
the library to get additional polymorphism. 

-- Brian



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

* RE: first class, recursive, mixin modules (was: RE: first class m odules)
  2001-02-09  9:41 first class, recursive, mixin modules (was: RE: first class m odules) Claudio Russo
  2001-02-09 16:47 ` Brian Rogoff
@ 2001-02-09 21:45 ` William Chesters
  1 sibling, 0 replies; 8+ messages in thread
From: William Chesters @ 2001-02-09 21:45 UTC (permalink / raw)
  To: caml-list

Claudio Russo writes:
 > I'm not really sure it bites that many, but I'd like to be told
 > otherwise. It does really hit you when trying to 
 > implement Chris Okasakis elegant bootstrapped data structures, or
 > emulate object oriented things with modules.  (Together with first-class
 > and recursive structure, you can model quite a bit of object oriented
 > stuff, but I'm not sure how natural or efficient this appproach is.) 

I've always been interested by this; you get an intriguing cross
between (in C++ terms) templates and classes.



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

* RE: first class, recursive, mixin modules (was: RE: first class m odules)
@ 2001-01-15 14:13 Dave Berry
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Berry @ 2001-01-15 14:13 UTC (permalink / raw)
  To: Brian Rogoff, Claudio Russo
  Cc: Dave Berry, Alain Frisch, Caml list, kfl, sestoft

----Original Message-----
From: Brian Rogoff [mailto:bpr@best.com]
Sent: Friday, January 12, 2001 22:16
>That's no problem for me. Dave, in the case you mentioned, do you think
>this would this be problematic? I couldn't guess from your description.

This example has been bugging me all weekend; I can't reconstruct what it
was.  I think we wanted to write a pair of recursive functor applications,
viz:

structure S1 = F1 (S2)
and S2 = F2 (S1);

but I find it hard to believe that the two functors already existed in a
form suitable to apply this way.  More likely, I suspect, was that we wanted
to make the minimum modification to each module hierarchy to put them into
this form.  In particular, we wanted to avoid having to extract a file to be
shared at the bottom of the two hierarchies, on the grounds that this would
break the abstractions we had set up.

So what I would like from a recursive module feature is the ability to
separately compile two functors and then mutually apply them, as above.  (Or
some equivalent using forward declarations, perhaps).  I realise that in
separately compiling the two functors I might produce a less efficient
representation for the datatypes that are split across the two functors, but
I could live with that.

Dave.



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

* RE: first class, recursive, mixin modules (was: RE: first class m  odules)
@ 2001-01-14 20:51 Brian Rogoff
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Rogoff @ 2001-01-14 20:51 UTC (permalink / raw)
  To: caml-list

On Fri, 12 Jan 2001, Claudio Russo wrote:
> I wasn't quite sure of your intention, but I did get the attached code
> to work in Mosml (it includes a port of the Ocaml libraries and a
> fleshed out implementation of your idea).

Cool! OK, now Alain has at least one example of a practically useful case
handled by your scheme :-). I suspect that this problem bites lots of ML 
programmers, and a fix is eagerly desired by at least two OCaml
programmers. Congratulations on making this work, the millenium is
starting off on a great note already!

> Unfortunately, this only works in an internal release of Moscow, because
> of a (known) bug in the current distribution. 

Well, even more unfortunately, a fix in Mosml doesn't help me unless you
change to Mosocaml. I couldn't switch to SML even if I wanted to, and I 
don't want to! Hopefully the OCaml Implementors (you guys are even
capitalized now) will "borrow back" the Mosml improvements into OCaml. 

> For the record, your functor application Make(Ord)is fine because it is
> applied to a local, already defined structure.
[...snip...]
> An application like Make(T.Ord), through the forward reference, would
> raise the Bind exception, because T (and T.Ord) is 
> undefined at that point (although Ord is).

That's no problem for me. Dave, in the case you mentioned, do you think
this would this be problematic? I couldn't guess from your description.

-- Brian 

> > -----Original Message-----
> > From: Brian Rogoff [mailto:bpr@best.com]
> > Sent: 11 January 2001 20:01
> > To: Dave Berry
> > Cc: Claudio Russo; Alain Frisch; Caml list
> > Subject: RE: first class, recursive, mixin modules (was: RE: 
> > first class
> > m odules)
> > 
> > 
> > My "litmus test" for recursive modules is that it fixes the well known
> > problem with expressing what OO folk call the Composite pattern,
> > essentially a recursively defined collection type with a leaf/node
> > relationship. Here is an approxmation of what I want to do in 
> > "faux-Mosml
> > with OCaml libraries". Forgive my errors, I don't use SML. The idea
> > should be clear. 
> > 
> > signature COMPOSITE = 
> >     rec(X : sig structure CompositeSet : sig type t end end) 
> >     sig structure Composite : 
> >                   sig 
> >                     datatype t = 
> >                       { data : int ; children : X.CompositeSet.t }
> >                   end
> >         structure CompositeSet : (Set.S where type elt = Composite.t) 
> >     end;
> > 
> > structure T = rec(X : COMPOSITE) 
> >   struct 
> > 	structure Composite = 
> >           struct 
> >             datatype t = { data : int ; children : X.CompositeSet.t }
> >           end
> >         structure Ord : Set.OrderedType = 
> >           struct 
> >             type t = Composite.t 
> >             let compare = Pervasives.compare
> >           end
> > 	structure CompositeSet = Set.Make(Ord)  
> >     end
> > 
> > This is syntactically heavy, but better than the 
> > parameterization trick 
> > needed now, and I'd be satisfied. I do need to do that functor
> > instantiation, so if you can't do it in Mosml it needs to be added. 
> > 
> > I agree that the first-class module extension is useful on 
> > its own too,
> > but in my own programming the problem I mention above arises 
> > frequently
> > enough that I consider this a flaw of (current) ML style 
> > modules. Every 
> > language has flaws but since OCaml is so close to perfection 
> > every flaw 
> > seems large ;-). 
> > 
> > -- Brian



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

* RE: first class, recursive, mixin modules (was: RE: first class m odules)
@ 2001-01-12 12:12 Claudio Russo
  0 siblings, 0 replies; 8+ messages in thread
From: Claudio Russo @ 2001-01-12 12:12 UTC (permalink / raw)
  To: Brian Rogoff, Dave Berry; +Cc: Alain Frisch, Caml list, kfl, sestoft

I wasn't quite sure of your intention, but I did get the attached code
to work in Mosml (it includes
a port of the Ocaml libraries and a fleshed out implementation of your
idea).

Unfortunately, this only works in an internal release of Moscow, because
of a (known)
bug in the current distribution. 

For the record, your functor application Make(Ord)is fine because it is
applied to a local, already defined structure.
> structure T = rec(X : COMPOSITE) 
>   struct 
> 	structure Composite = 
>           struct 
>             datatype t = { data : int ; children : X.CompositeSet.t }
>           end
>         structure Ord : Set.OrderedType = 
>           struct 
>             type t = Composite.t 
>             let compare = Pervasives.compare
>           end
> 	structure CompositeSet = Set.Make(Ord)  
>     end
An application like Make(T.Ord), through the forward reference, would
raise the Bind exception, because T (and T.Ord) is 
undefined at that point (although Ord is).

-c


> -----Original Message-----
> From: Brian Rogoff [mailto:bpr@best.com]
> Sent: 11 January 2001 20:01
> To: Dave Berry
> Cc: Claudio Russo; Alain Frisch; Caml list
> Subject: RE: first class, recursive, mixin modules (was: RE: 
> first class
> m odules)
> 
> 
> My "litmus test" for recursive modules is that it fixes the well known
> problem with expressing what OO folk call the Composite pattern,
> essentially a recursively defined collection type with a leaf/node
> relationship. Here is an approxmation of what I want to do in 
> "faux-Mosml
> with OCaml libraries". Forgive my errors, I don't use SML. The idea
> should be clear. 
> 
> signature COMPOSITE = 
>     rec(X : sig structure CompositeSet : sig type t end end) 
>     sig structure Composite : 
>                   sig 
>                     datatype t = 
>                       { data : int ; children : X.CompositeSet.t }
>                   end
>         structure CompositeSet : (Set.S where type elt = Composite.t) 
>     end;
> 
> structure T = rec(X : COMPOSITE) 
>   struct 
> 	structure Composite = 
>           struct 
>             datatype t = { data : int ; children : X.CompositeSet.t }
>           end
>         structure Ord : Set.OrderedType = 
>           struct 
>             type t = Composite.t 
>             let compare = Pervasives.compare
>           end
> 	structure CompositeSet = Set.Make(Ord)  
>     end
> 
> This is syntactically heavy, but better than the 
> parameterization trick 
> needed now, and I'd be satisfied. I do need to do that functor
> instantiation, so if you can't do it in Mosml it needs to be added. 
> 
> I agree that the first-class module extension is useful on 
> its own too,
> but in my own programming the problem I mention above arises 
> frequently
> enough that I consider this a flaw of (current) ML style 
> modules. Every 
> language has flaws but since OCaml is so close to perfection 
> every flaw 
> seems large ;-). 
> 
> -- Brian
> 
>  On Thu, 11 Jan 2001, Dave Berry wrote:
> 
> > We ran into an example (in SML) during the development of 
> MLWorks.  I can
> > only remember it vaguely, but there were two large module 
> hierarchies.
> > These hierarchies were in logically different parts of the 
> system.  A new
> > development built on top of these hierarchies meant that we 
> needed to make
> > one element from the bottom of each hierarchy be mutually 
> recursive with
> > each other.  I suspect that since we were using a fully 
> functorised style,
> > what we wanted to do was to make two functors mutually 
> recursive.  In
> > practice we had to combine the module hierarchies to make 
> the types and
> > values mutually recursive at the bottom of the new hierarchy.
> > 
> > I wish I could remember what the example was, because it 
> was a clear case
> > where the ML module system was too inflexible to meet the 
> pragmatic needs.
> > Imagine how we would have been stuck if the two module 
> hierarchies were
> > libraries from different suppliers, especially if they were 
> only distributed
> > in compiled form.
> > 
> > Dave. 
> >   
> > 
> > -----Original Message-----
> > From: Claudio Russo [mailto:crusso@microsoft.com]
> > Sent: Thursday, January 11, 2001 10:33
> > To: Alain Frisch
> > Cc: Brian Rogoff; Caml list
> > Subject: RE: first class, recursive, mixin modules (was: 
> RE: first class
> > modules)
> > 
> > 
> > 
> 


begin 600 composite.sml
M*"HJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ
M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*0T**"H@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`J*0T**"H@("`@("`@("`@("`@("`@("`@("`@("`@("!/
M8FIE8W1I=F4@0V%M;"`@("`@("`@("`@("`@("`@("`@("`@("`@("`J*0T*
M*"H@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`J*0T**"H@("`@("`@("`@("!8
M879I97(@3&5R;WDL('!R;VIE="!#<FES=&%L+"!)3E))02!2;V-Q=65N8V]U
M<G0@("`@("`@("`J*0T**"H@("`@("`@("`@("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`J*0T*
M*"H@($-O<'ER:6=H="`Q.3DV($EN<W1I='5T($YA=&EO;F%L(&1E(%)E8VAE
M<F-H92!E;B!);F9O<FUA=&EQ=64@970@("`J*0T**"H@(&5N($%U=&]M871I
M<75E+B`@06QL(')I9VAT<R!R97-E<G9E9"X@(%1H:7,@9FEL92!I<R!D:7-T
M<FEB=71E9"`@("`J*0T**"H@('5N9&5R('1H92!T97)M<R!O9B!T:&4@1TY5
M($QI8G)A<GD@1V5N97)A;"!0=6)L:6,@3&EC96YS92X@("`@("`@("`J*0T*
M*"H@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`J*0T**"HJ*BHJ*BHJ*BHJ*BHJ
M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ
M*BHJ*BHJ*BHJ*BHJ*0T*#0HH*B`D260Z('-E="YM;"QV(#$N,3,@,C`P,"\P
M-"\Q,R`Q,CHQ-CHR-B!X;&5R;WD@17AP("0@*BD-"@T**"H@4V5T<R!O=F5R
M(&]R9&5R960@='EP97,@*BD-"F5X8V5P=&EO;B!);G9A;&ED7V%R9R!O9B!S
M=')I;F<[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@("`@("`@("`@("`@("`@(&-R96%T92`H8W)E871E(&QL
M(&QV(&QR;"D@;')V("AC<F5A=&4@;')R('@@<BD-"B`@("`@("`@("`@("D-
M"B`@("`@("D@96QS92!I9B!H<B`^(&AL("L@,B!T:&5N("@-"B`@("`@("`@
M8V%S92!R(&]F#0H@("`@("`@("`@16UP='D@/3X@:6YV86QI9%]A<F<@(E-E
M="YB86PB#0H@("`@("`@('P@3F]D92AR;"P@<G8L(')R+"!?*2`]/@T*("`@
M("`@("`@("`@:68@:&5I9VAT(')R(#X](&AE:6=H="!R;"!T:&5N#0H@("`@
M("`@("`@("`@(&-R96%T92`H8W)E871E(&P@>"!R;"D@<G8@<G(-"B`@("`@
M("`@("`@(&5L<V4@*`T*("`@("`@("`@("`@("!C87-E(')L(&]F#0H@("`@
M("`@("`@("`@("`@16UP='D@/3X@:6YV86QI9%]A<F<@(E-E="YB86PB#0H@
M("`@("`@("`@("`@('P@3F]D92AR;&PL(')L=BP@<FQR+"!?*2`]/@T*("`@
M("`@("`@("`@("`@("`@8W)E871E("AC<F5A=&4@;"!X(')L;"D@<FQV("AC
M<F5A=&4@<FQR(')V(')R*0T*("`@("`@("`@("`@*0T*("`@("`@*2!E;'-E
M#0H@("`@("`@($YO9&4H;"P@>"P@<BP@*&EF(&AL(#X](&AR('1H96X@:&P@
M*R`Q(&5L<V4@:'(@*R`Q*2D-"B`@("`@(&5N9`T*("`@#0H@("`@*"H@4V%M
M92!A<R!B86PL(&)U="!R97!E870@<F5B86QA;F-I;F<@=6YT:6P@=&AE(&9I
M;F%L(')E<W5L=`T*("`@("`@(&ES(&)A;&%N8V5D+B`J*0T*#0H@("`@9G5N
M(&IO:6X@;"!X('(@/0T*("`@("`@8V%S92!B86P@;"!X('(@;V8-"B`@("`@
M("`@16UP='D@/3X@:6YV86QI9%]A<F<@(E-E="YJ;VEN(@T*("`@("`@?"!T
M)R!A<R!.;V1E*&PG+"!X)RP@<B<L(%\I("`]/@T*("`@("`@("`@(&QE="!V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>2P@3D].12P@16UP='DI#0H@("`@("!\($YO9&4H;"P@=BP@<BP@7RD@
M/3X-"B`@("`@("`@("!L970@=F%L(&,@/2!/<F0N8V]M<&%R92!X('8@:6X-
M"B`@("`@("`@("!I9B!C(#T@,"!T:&5N("AL+"!33TU%('8L('(I#0H@("`@
M("`@("`@96QS92!I9B!C(#P@,"!T:&5N#0H@("`@("`@("`@("!L970@=F%L
M("AL;"P@=FPL(')L*2`]('-P;&ET('@@;"!I;B`H;&PL('9L+"!J;VEN(')L
M('8@<BD@96YD#0H@("`@("`@("`@96QS90T*("`@("`@("`@("`@;&5T('9A
M;"`H;'(L('9R+"!R<BD@/2!S<&QI="!X('(@:6X@*&IO:6X@;"!V(&QR+"!V
M<BP@<G(I(&5N9`T*"2`@96YD#0H-"B`@("`H*B!);7!L96UE;G1A=&EO;B!O
M9B!T:&4@<V5T(&]P97)A=&EO;G,@*BD-"@T*("`@('9A;"!E;7!T>2`]($5M
M<'1Y#0H-"B`@("!V86P@:7-?96UP='D@/2!F;B!%;7!T>2`]/B!T<G5E('P@
M7R`]/B!F86QS90T*#0H@("`@9G5N(&UE;2!X(#T@9FX-"B`@("`@("`@16UP
M='D@/3X@9F%L<V4-"B`@("`@('P@3F]D92AL+"!V+"!R+"!?*2`]/@T*("`@
M("`@("`@(&QE="!V86P@(&,@/2!/<F0N8V]M<&%R92!X('8@:6X-"B`@("`@
M("`@("!C(#T@,"!O<F5L<V4@;65M('@@*&EF(&,@/"`P('1H96X@;"!E;'-E
M('(I(&5N9`T*#0H@("`@9G5N(&%D9"!X(#T@9FX-"B`@("`@("`@16UP='D@
M/3X@3F]D92A%;7!T>2P@>"P@16UP='DL(#$I#0H@("`@("!\('0@87,@3F]D
M92AL+"!V+"!R+"!?*2`]/@T*("`@("`@("`@(&QE="!V86P@8R`]($]R9"YC
M;VUP87)E('@@=B!I;@T*("`@("`@("`@(&EF(&,@/2`P('1H96X@="!E;'-E
M#0H@("`@("`@("`@:68@8R`\(#`@=&AE;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L,BP@=C(L('(R+"!?*2DI(#T^
M#0H@("`@("`@("`@;&5T('9A;"!C(#T@3W)D+F-O;7!A<F4@=C$@=C(@:6X-
M"B`@("`@("`@("!I9B!C(#T@,"!T:&5N#0H@("`@("`@("`@("!S=6)S970@
M;#$@;#(@86YD86QS;R!S=6)S970@<C$@<C(-"B`@("`@("`@("!E;'-E(&EF
M(&,@/"`P('1H96X-"B`@("`@("`@("`@('-U8G-E="`H3F]D92`H;#$L('8Q
M+"!%;7!T>2P@,"DI(&PR(&%N9&%L<V\@<W5B<V5T('(Q('0R#0H@("`@("`@
M("`@96QS90T*("`@("`@("`@("`@<W5B<V5T("A.;V1E("A%;7!T>2P@=C$L
M('(Q+"`P*2D@<C(@86YD86QS;R!S=6)S970@;#$@=#(-"@D@(&5N9`T*#0H@
M("`@9G5N(&ET97(@9B`](&9N#0H@("`@("`@($5M<'1Y(#T^("@I#0H@("`@
M("!\($YO9&4H;"P@=BQR+"!?*2`]/B`H:71E<B!F(&P[(&8@=CL@:71E<B!F
M('(I#0H-"B`@("!F=6X@9F]L9"!F(',@86-C=2`]#0H@("`@("!C87-E(',@
M;V8-"B`@("`@("`@16UP='D@/3X@86-C=0T*("`@("`@?"!.;V1E*&PL('8L
M('(L(%\I(#T^(&9O;&0@9B!L("AF('8@*&9O;&0@9B!R(&%C8W4I*0T*#0H@
M("`@9G5N(&9O<E]A;&P@<"`](&9N#0H@("`@("`@($5M<'1Y(#T^('1R=64-
M"B`@("`@('P@3F]D92AL+"!V+"!R+"!?*2`]/B!P('8@86YD86QS;R!F;W)?
M86QL('`@;"!A;F1A;'-O(&9O<E]A;&P@<"!R#0H-"B`@("!F=6X@97AI<W1S
M('`@/2!F;@T*("`@("`@("!%;7!T>2`]/B!F86QS90T*("`@("`@?"!.;V1E
M*&PL('8L('(L(%\I(#T^('`@=B!O<F5L<V4@97AI<W1S('`@;"!O<F5L<V4@
M97AI<W1S('`@<@T*#0H@("`@9G5N(&9I;'1E<B!P(',@/0T*("`@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('8L('(L
M(%\I(#T^('8-"B`@("`@('P@3F]D92AL+"!V+"!R+"!?*2`]/B!M:6Y?96QT
M(&P-"@T*("`@(&9U;B!M87A?96QT('@@/2!C87-E('@@;V8-"B`@("`@("`@
M16UP='D@/3X@<F%I<V4@3F]T7V9O=6YD#0H@("`@("!\($YO9&4H;"P@=BP@
M16UP='DL(%\I(#T^('8-"B`@("`@('P@3F]D92AL+"!V+"!R+"!?*2`]/B!M
M87A?96QT('(-"@T*("`@('9A;"!C:&]O<V4@/2!M:6Y?96QT#0H-"B`@96YD
M#0H[#0H-"B@J('=E(&YE960@86X@87!P;&EC871I=F4@=F5R<VEO;B!O9B!-
M86ME('1O(&=E="!T:&ES('1O('=O<FL@*BD-"@T*9G5N8W1O<B!!<'!-86ME
M($\Z3W)D97)E9%1Y<&4@/2!-86ME*$\I.PT*#0IS:6=N871U<F4@0T]-4$]3
M251%(#T@#0H@("`@<F5C*%@@.B!S:6<@<W1R=6-T=7)E($-O;7!O<VET95-E
M="`Z('-I9R!T>7!E('0@96YD(&5N9"D@#0H@("`@<VEG('-T<G5C='5R92!#
M;VUP;W-I=&4@.B`-"B`@("`@("`@("`@("`@("`@('-I9R`-"B`@("`@("`@
M("`@("`@("`@("`@9&%T871Y<&4@="`]("!4(&]F#0H@("`@("`@("`@("`@
M("`@("`@("`@>R!D871A(#H@:6YT("P@8VAI;&1R96X@.B!8+D-O;7!O<VET
M95-E="YT('T-"B`@("`@("`@("`@("`@("`@(&5N9`T*("`@("`@("!S=')U
M8W1U<F4@3W)D.B!/<F1E<F5D5'EP92!W:&5R92!T>7!E('0@/2!#;VUP;W-I
M=&4N=`T*("`@("`@("!S=')U8W1U<F4@0V]M<&]S:71E4V5T(#H@4V5T('=H
M97)E('1Y<&4@96QT(#T@02YE;'0@=VAE<F4@02`]($%P<$UA:V4H3W)D*2`-
M"@D@("`@("`@("`@("`@("`@("`@("`@("`@("`@('=H97)E('1Y<&4@="`]
M($$N="!W:&5R92!!(#T@07!P36%K92A/<F0I(`T*("`@(&5N9#L-"@T*<W1R
M=6-T=7)E(%0@/2!R96,H6"`Z($-/35!/4TE412D@#0H@('-T<G5C="`-"@ES
M=')U8W1U<F4@0V]M<&]S:71E(#T@#0H@("`@("`@("`@<W1R=6-T(`T*("`@
M("`@("`@("`@9&%T871Y<&4@="`](&1A=&%T>7!E(%@N0V]M<&]S:71E+G0-
M"B`@("`@("`@("!E;F0-"B`@("`@("`@<W1R=6-T=7)E($]R9"`Z($]R9&5R
M9614>7!E(#T@#0H@("`@("`@("`@<W1R=6-T(`T*("`@("`@("`@("`@='EP
M92!T(#T@0V]M<&]S:71E+G0@#0H@("`@("`@("`@("!F=6X@8V]M<&%R92`H
M0V]M<&]S:71E+E0@>V1A=&$]9#$L8VAI;&1R96X]8S%]*0T*"0D)*$-O;7!O
M<VET92Y4('MD871A(#T@9#(L8VAI;&1R96X@/2!C,GTI#0H)("`@("`@(#T@
M("`@*&EF(&0Q(#P@9#(@=&AE;B!^,2!E;'-E(&EF(&0Q(#T@9#(@=&AE;B`P
M(&5L<V4@,2D@*"H_/S\J*0T*"0D@("H@*%@N0V]M<&]S:71E4V5T+F-O;7!A
M<F4@8S$@8S(I.PT*("`@("`@("`@(&5N9`T*"7-T<G5C='5R92!#;VUP;W-I
M=&53970@/2!!<'!-86ME*$]R9"DZ4V5T("`-"B`@("!E;F0[#0H-"@T*#0H-
!"@==
`
end



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

* RE: first class, recursive, mixin modules (was: RE: first class m odules)
  2001-01-11 18:15 Dave Berry
@ 2001-01-11 20:01 ` Brian Rogoff
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Rogoff @ 2001-01-11 20:01 UTC (permalink / raw)
  To: Dave Berry; +Cc: Claudio Russo, Alain Frisch, Caml list

My "litmus test" for recursive modules is that it fixes the well known
problem with expressing what OO folk call the Composite pattern,
essentially a recursively defined collection type with a leaf/node
relationship. Here is an approxmation of what I want to do in "faux-Mosml
with OCaml libraries". Forgive my errors, I don't use SML. The idea
should be clear. 

signature COMPOSITE = 
    rec(X : sig structure CompositeSet : sig type t end end) 
    sig structure Composite : 
                  sig 
                    datatype t = 
                      { data : int ; children : X.CompositeSet.t }
                  end
        structure CompositeSet : (Set.S where type elt = Composite.t) 
    end;

structure T = rec(X : COMPOSITE) 
  struct 
	structure Composite = 
          struct 
            datatype t = { data : int ; children : X.CompositeSet.t }
          end
        structure Ord : Set.OrderedType = 
          struct 
            type t = Composite.t 
            let compare = Pervasives.compare
          end
	structure CompositeSet = Set.Make(Ord)  
    end

This is syntactically heavy, but better than the parameterization trick 
needed now, and I'd be satisfied. I do need to do that functor
instantiation, so if you can't do it in Mosml it needs to be added. 

I agree that the first-class module extension is useful on its own too,
but in my own programming the problem I mention above arises frequently
enough that I consider this a flaw of (current) ML style modules. Every 
language has flaws but since OCaml is so close to perfection every flaw 
seems large ;-). 

-- Brian

 On Thu, 11 Jan 2001, Dave Berry wrote:

> We ran into an example (in SML) during the development of MLWorks.  I can
> only remember it vaguely, but there were two large module hierarchies.
> These hierarchies were in logically different parts of the system.  A new
> development built on top of these hierarchies meant that we needed to make
> one element from the bottom of each hierarchy be mutually recursive with
> each other.  I suspect that since we were using a fully functorised style,
> what we wanted to do was to make two functors mutually recursive.  In
> practice we had to combine the module hierarchies to make the types and
> values mutually recursive at the bottom of the new hierarchy.
> 
> I wish I could remember what the example was, because it was a clear case
> where the ML module system was too inflexible to meet the pragmatic needs.
> Imagine how we would have been stuck if the two module hierarchies were
> libraries from different suppliers, especially if they were only distributed
> in compiled form.
> 
> Dave. 
>   
> 
> -----Original Message-----
> From: Claudio Russo [mailto:crusso@microsoft.com]
> Sent: Thursday, January 11, 2001 10:33
> To: Alain Frisch
> Cc: Brian Rogoff; Caml list
> Subject: RE: first class, recursive, mixin modules (was: RE: first class
> modules)
> 
> 
> 



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

* RE: first class, recursive, mixin modules (was: RE: first class m odules)
@ 2001-01-11 18:15 Dave Berry
  2001-01-11 20:01 ` Brian Rogoff
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Berry @ 2001-01-11 18:15 UTC (permalink / raw)
  To: Claudio Russo, Alain Frisch; +Cc: Brian Rogoff, Caml list

We ran into an example (in SML) during the development of MLWorks.  I can
only remember it vaguely, but there were two large module hierarchies.
These hierarchies were in logically different parts of the system.  A new
development built on top of these hierarchies meant that we needed to make
one element from the bottom of each hierarchy be mutually recursive with
each other.  I suspect that since we were using a fully functorised style,
what we wanted to do was to make two functors mutually recursive.  In
practice we had to combine the module hierarchies to make the types and
values mutually recursive at the bottom of the new hierarchy.

I wish I could remember what the example was, because it was a clear case
where the ML module system was too inflexible to meet the pragmatic needs.
Imagine how we would have been stuck if the two module hierarchies were
libraries from different suppliers, especially if they were only distributed
in compiled form.

Dave. 
  

-----Original Message-----
From: Claudio Russo [mailto:crusso@microsoft.com]
Sent: Thursday, January 11, 2001 10:33
To: Alain Frisch
Cc: Brian Rogoff; Caml list
Subject: RE: first class, recursive, mixin modules (was: RE: first class
modules)




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

end of thread, other threads:[~2001-02-10 21:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-09  9:41 first class, recursive, mixin modules (was: RE: first class m odules) Claudio Russo
2001-02-09 16:47 ` Brian Rogoff
2001-02-09 21:45 ` William Chesters
  -- strict thread matches above, loose matches on Subject: below --
2001-01-15 14:13 Dave Berry
2001-01-14 20:51 Brian Rogoff
2001-01-12 12:12 Claudio Russo
2001-01-11 18:15 Dave Berry
2001-01-11 20:01 ` Brian Rogoff

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