Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Functors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jdh30@c...>
Subject: Re: [Caml-list] Functors
On Wednesday 05 May 2004 21:41, brogoff@speakeasy.net wrote:
> I'm not sure I understand the difference, since there is only one
> defunctorizer for OCaml, wouldn't including it in the compiler be the
> easiest way to get that functionality?

As someone else said, using a "defunctorizer" apparently makes it impossible 
to perform some static analysis. Obviously, static analysis is a strong point 
of the language so we definitely want to keep that. I think this is an 
example of the static analysis being broken: use the core library Set functor 
to create a module implementing a set of integers, create two sets and merge 
them. If this were functorised, the integer compare could be inlined (which 
would probably result in a significant performance boost) but it would no 
longer be possible to statically check that the two sets being merged shared 
a common comparison function (which could be done statically before provided 
they were both created by our "integer set" module) because you can't compare 
functions.

So you don't want to just plug the defunctorizer into the compiler. I was 
suggesting the application of much lower-level code transformations (at 
intermediate- or assembler-representations) when possible, to in-line small 
functions slightly more aggressively. I think this would be very useful, 
probably quite easy to implement and I can't think of any downsides.

> ...

I would have thought that a bytecode->C compiler would be quite feasible and, 
perhaps, quite useful. What other compilers for ocaml are there?

Cheers,
Jon.

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