Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Wanted - General Purpose "Glue Logic" Data-Structures
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Brown <caml-list@d...>
Subject: Re: [Caml-list] Re: Wanted - General Purpose "Glue Logic" Data-Structures
On Thu, Apr 10, 2003 at 12:35:19PM +0200, Markus Mottl wrote:

> There is one problem with this: you still need to fill in an object. If
> you use one provided by the user, this will consume memory dependent
> on the object size. Therefore, it is usually best to overwrite the
> slot using evil "Obj.magic" inside of the library. Note that there may
> also be finalizers associated with the value or it may be monitored by
> weak arrays.

If you fill with an object provided by the user (a special empty object)
there will only be one of them.  It's still tacky, since to use it, you
have to think of the smallest element of your type.

For something I recently did, I ended up using evil "Obj.magic" to make
the module easier to use.  Thanks to the RES example.

Dave

-------------------
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