Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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, 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