Browse thread
[Caml-list] Num library
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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 caml. 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... Chris ------------------- 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