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] Num library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris Hecker <checker@d...>
Subject: "custom" operators in caml (was: Re: [Caml-list] Num library)

>when nums are  involved  within  huge datatypes,  you  have to  write
>structural comparison  and hash functions  for these types. This  is a
>pain, really.

This brings up a general issue:  from the C side you can create custom 
blocks that have hooks for various operators 
(finalize,compare,hash,serialize).  Is there any way to do this from the ml 
side?  In other words, if you could hook into the num block somehow and 
register these operators in caml that would allow you do embed them in 
datastructures and use =, and the runtime would call eq_num.

Of course, you don't want the whole block to be custom, because you want 
ocaml to scan it in the gc and you want it to be able to be operated on in 

I assume there's no way to do this, since you'd need a new block type, and 
there are no more tags left without lowering No_scan_tag, which would break 
everything (or at least anything that has a big constant variant), I 
assume.  But I don't know.

Just another thought in my continuing desire to be able to do everything 
without dropping to C...


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