Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ask for a more efficient way to deallocate memory (full version)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Ask for a more efficient way to deallocate memory (full version)
On Saturday 15 December 2007 21:33, Oliver Bandel wrote:
> Zitat von Jon Harrop <jon@ffconsultancy.com>:
> > So Martin's code adds a
> > new
> > syntactic construct and automatically injects the code for the
> > compiler that
> > we must currently write by hand. Consequently, its performance will
> > be
> > superb: as good as hand-written OCaml code.
>
> So, is it just a kind of pre-compilation?

You could say that, yes. It is pre-compiling code written in your own syntax 
into ordinary OCaml code.

> The core-OCaml compiler will be the same?

Yes.

> Is the TryFinally-code slight enough, so that
> it's behaving like handwritten OCaml?

Exactly, yes. If you're worried about performance then there are cases where 
you can actually use camlp4 macros to improve performance.

> Did you look at the TryFinally in detail?

The article I wrote for the OCaml Journal actually walks through the creation 
of a camlp4 macro that augments OCaml's syntax with a try..finally construct.

> > However, using any camlp4 macros requires using the camlp4
> > replacement for the
> > front-end of the compiler.
>
> I have not looked at the OCaml-compiler in detail,
> but from what you wrote I would assume, there
> are at least two parts.

You don't really see that there are two parts to the compiler. The only thing 
that intrudes on the programmer (besides different error messages) is the new 
compilation line.

> I had not needed camlp4 so far. And I don't know if it makes sense to
> look at it now, because there will be (or already is?) a replacement
> (from 3.10 on?).

I've only been talking about the new implementation in OCaml 3.10 and beyond. 
There was a previous implementation as well (now renamed camlp5).

> I hope the camlp4-tutorial will be updated to the camlp4-replacement.
> Possibly later I might use it. Then it would be good to have
> introductional material.

Yes. There is certainly a shortage of information on this subject. Eventually 
the camlp5 will be phased out but I can't see that happening until its new 
replacement camlp4 is properly documented.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e