Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Printf: export of format_int et al.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christian Lindig <lindig@c...>
Subject: [Caml-list] Printf: export of format_int et al.

We have code that uses some of the external functions like format_int 
and format_float.

external format_int: string -> int -> string = "caml_format_int"

Now that OCaml 3.08 has prefixed all C names with "caml_" (eg. 
"caml_format_int" instead of "format_int") it is more difficult to 
write code that compiles with old and new OCaml versions. It would be 
of great help if future OCaml versions would export these C functions 
as (stable) Caml values such that we could use these rather than the 
external values directly.

For example, format_int is defined in the Printf implementation, but 
not exported in the interface. Hashtbl gets it right, because 
"caml_hash_univ_param" is exported as Hashtbl.hash_param in the 
interface. Therefore we can use hash_param rather than 
cam_hash_univ_param.

external hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" 
"noalloc"

Maybe a new module "Externals" to centralize all these exports would be 
a solution if we don't want to touch the existing interfaces.

-- Christian

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