From: David T. <Dav...@un...> - 2008-05-18 21:56:17
|
Hi, 1) For [get_exn], I reason that, with ExtLib's conventions, when writing a module for a new data structure, one often has to write two functions: * some_kind_of_get : 'a t -> 'a option * some_kind_of_get': 'a t -> 'a (**raises [ThisModule.NotFound] *) Having [Option.get_exn] makes it possible to write the second function from the first one as a (real) one-liner. 2) For [Option.enum], it's not a big deal, just a matter of uniformisation wrt other containers. I consider also adding [iter] and [filter]. Cheers, David On Sun, 2008-05-18 at 23:28 +0300, Janne Hellsten wrote: > Hi David, > > What kind of example uses did you have in mind for the Option > additions? > > Not sure if I agree that get_exn is too useful an addition. If > Not_found for the (often erroneous) case of (Option.get None) is not > generic enough, couldn't you just match the option and throw the > exception yourself: > > match o with None -> raise your_exception | Some f -> f > > What's the use case for Option.enum? > > Janne -- David Teller Security of Distributed Systems http://www.univ-orleans.fr/lifo/Members/David.Teller Angry researcher: French Universities need reforms, but the LRU act brings liquidations. |