[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Shivkumar Chandrasekaran <shiv@e...> |
| Subject: | Re: [Caml-list] functors with style? |
On Monday, November 19, 2001, at 10:32 AM, Krishnaswami, Neel wrote: > > A functor is compiled to what is essentially a function that > takes a record as an argument (the module it receives as an > argument), and returns a record of functions and values. So > code generation happens only once for each functor, and each > functor application takes a very small amount of memory at > link time. > Which of course is a problem at the "small-scale". For example I would like to develop a functor that is generic over the representation of reals (float32_elt, float64_elt, fixed_point, etc.). But now if I instantiate it for float64_elt and do arithmetic over float64_elt even simple operations will be looked-up at run-time leading to a terrible performance loss. Ideally I would prefer it if the compiler allowed the programmer to decide which functor applications lead to compile-time code generation and which are through dictionary-passing. For example, in Clean (which has type classes not functors of course), instants of basic types be prevented from using dictionary passing. Not sure what happens in haskell though... --shiv-- ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr