From: Nicolas C. <war...@fr...> - 2003-03-03 05:44:50
|
> The name ExtPervasives is misleading, because > there functions are not "pervasive" in the truest sense, > however the name does fit with the pattern Ext+OCaml core > library name. ExtStd is perhaps a better name > (* SML-like names; other have suggested alternates: > handling 'a options w/o match cases *) > val val_of : 'a option -> 'a > val is_some : 'a option -> bool I moved theses as well some functions sent previously by Olivier into a new module "Option" module Option : sig val may : ('a -> unit) -> 'a option -> unit val map : ('a -> 'b) -> 'a option -> 'b option val default : 'a -> 'a option -> 'a val is_some : 'a option -> bool val is_none : 'a option -> bool end > val string_of_bool : bool -> string this one already exists :) > val print_bool : bool -> unit > val prerr_bool : bool -> unit agree. ( When I agree and when it seems obvious that people will also agree, I'm automaticaly adding it to my local ExtLib file , and then later I 'll review it to do some commenting and renaming ) > val output_int : out_channel -> int -> unit > val output_float : out_channel -> float -> unit > ...etc for basic types... Too much verbose I think. Since most of the time you're printing mixed kind of values, fprintf is the best choice. I wouldn't like to promote such a programming style > Also, although I don't have this, what do people think about: > > val input_int : in_channel -> int > val input_float : in_channel -> float > val input_string : in_channel -> string > > Which would have similar semantics to the C++ ">>" operators: > whitespace delimits tokens, but is otherwise ignored, and line > breaks are just another whitespace delimiter. Same remark : use Scanf module ... or xml :) Nicolas Cannasse |