Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] const equivalent for mutable types?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] const equivalent for mutable types?
On Sun, 2004-08-01 at 00:31, Brian Hurt wrote:

> 
> This way lies hell.

Balance is the key.

I have in fact just converted a functional algorithm
to an imperative one. Its the Felix inliner (which
inlines functions).

What happens is I replace a function call with
the body of the function being called with the
argument replacing the parameter.

The purely functional algorithm was 
inefficient: it has to inline recursively,
and in doing so, it inlines the same function
calls multiple times, because there are multiple
calls. It is faster to 'cache' any inlining done
into a function so when *it* is called the inlined
version can be inlined.

The easiest way to do this caching is simply replace
the function into which inlining is done with the
inlined version :)


-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.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