From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA22878; Wed, 24 Apr 2002 16:28:01 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA22945 for ; Wed, 24 Apr 2002 16:28:01 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3OES0116218 for ; Wed, 24 Apr 2002 16:28:00 +0200 (MET DST) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rto3.wanadoo.fr; 24 Apr 2002 16:28:00 +0200 Received: from debian (80.8.81.4) by mel-rta7.wanadoo.fr (6.5.007) id 3CBAA82000421BE5 for caml-list@inria.fr; Wed, 24 Apr 2002 16:28:00 +0200 Received: from moi by debian with local (Exim 3.35 #1 (Debian)) id 170Nke-0001vi-00 for ; Wed, 24 Apr 2002 16:28:08 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] Some/None References: From: Remi VANICAT Date: 24 Apr 2002 16:28:08 +0200 In-Reply-To: Message-ID: <87znzt5fyf.dlv@wanadoo.fr> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Oliver Bandel writes: > But I have to think about it in more detail. > Does it make sense to give back None/Some > out of a function (e.g. is_regularfile/is_directory/...) > or is it only useful inside functions in > try- and match-statements? Really ? it depend. in case of is_regularfile/is_directory/... these function seem to be test, they should return boolean. more generally, the main question is "is absence of value is very common, a normal behavior, or is it only a exceptional behavior ?". In the first case, I will probably use an optional value, and in the second case I will probably return a plain value, and raise an exception in the case there is no value. One can see that it's not widely use in the ocaml library, because most of the case are better handled by exception. But for example, the weak array of the module Weak contain value that may disappeared, an so use the option type. -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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