Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Function forward declaration?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-06 (15:15)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Function forward declaration?
On Tue, 2004-04-06 at 22:53, Correnson Loïc wrote:

>    better: you may pack several callback-functions into a record.

You can also use classes. Classes cost a small overhead,
but checking is much heavier: when you fill the slots of
an abstract class type with functions, you do so by
coercing an object to a class type, which checks the
functions have the correct names, as well as the right types.
In addition, the functions are declared together, so the collection
of functions is again more likely to be the right collection
than merely filling slots in a record or tuple...

... quite apart from the functions being able to share state in
a well organised way.

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: