Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] First order compile time functorial polymorphism in Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Carette <carette@m...>
Subject: Re: [Caml-list] First order compile time functorial polymorphism in Ocaml
John Max Skaller <skaller@ozemail.com.au> wrote:
> Jacques Carette wrote:
> Curious: how useful? How many times did you reuse it?

I've used generic_traverse in a dozen places, and will likely use it more often.

> Its a hack yes, looks ugly :(

Oh, fully agreed!  The point of posting it was to get some constructive criticism in the hopes of being able to do 
better.

> Perhaps can do better with polymorphic variants.

My first prototype (which got wiped out in some disk crash) did use polymorphic variants.  I decide to not use them 
again to see if I really needed them.  And perhaps I do.

> Ugly separating the filter
> for the special actions from those actions:

Very much so, but I found the combined filter/action routines even harder to read, with more code duplication than I 
could swallow!!  So I used this 2-stage approach.

> Uggh. Like to be writing something like
> 	| `Mlist args -> ..
> 	| `Mseq args -> ..
> 	| _ -> ..

I will re-explore this.

> or perhaps
> 	| #usual_case ->
> instead of the last line if there happens to be
> a type partition matching the requirements.

I read about #types in the Ocaml manual.  Are you referring to using classes or the (documented obsolete) expansion of 
variant types ?

Even though  S. Boulmé, Th. Hardin, and R. Rioboo in
"Polymorphic Data Types, Objects, Modules and Functors: is it too much ?" (see 
http://www.lip6.fr/reports/lip6.2000.014.html) argue quite cogently about the use of the full power of Ocaml for doing 
mathematics [my real goal], I was hoping that for writing a language interpreter I did not need to go that far.

Jacques

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