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 WAA13253; Thu, 13 Mar 2003 22:37:17 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA13422 for ; Thu, 13 Mar 2003 22:37:15 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from giynz (vp191026.reshsg.uci.edu [128.195.191.26]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h2DLb7f19015 for ; Thu, 13 Mar 2003 22:37:08 +0100 (MET) Received: from albro by giynz with local (Exim 3.36 #1 (Debian)) id 18taMs-0000pd-00; Thu, 13 Mar 2003 13:36:02 -0800 Subject: Re: [Caml-list] OCaml popularity From: "Daniel M. Albro" To: Karl Zilles Cc: caml-list@inria.fr In-Reply-To: <3E70F854.7020705@1969.ws> References: <1047539347.1603.32.camel@giynz> <3E70F854.7020705@1969.ws> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1047591362.1870.2.camel@giynz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 13 Mar 2003 13:36:02 -0800 X-Spam: no; 0.00; ucla:99 caml-list:01 slower:01 incr:01 fleshed:01 ocaml:01 exception:02 wrote:03 data:03 imperative:04 let:04 implement:05 ugly:05 raise:05 equivalent:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Yeah, I know, but in time testing I've noticed (I think) that exception Break;; try for i = 1 to 10 do if i = 5 then raise Break done with Break -> ();; is slower than the (ugly) equivalent let i = ref 1 in while !i <= 10 do if !i = 5 then i := 11; incr i done;; On Thu, 2003-03-13 at 13:29, Karl Zilles wrote: > Daniel M. Albro wrote: > > imperative side of the language will get fleshed out a bit with some > > expanded loop features like break statements, > > You can always implement a break statement as an exception: > > exception Break;; > > try for i = 1 to 10 do > if i == 5 then raise Break > done with Break -> ();; > > As an exception, you could (if you wanted) include special case handling > for the break, or create a more aptly named exception and pass through > data. -- Daniel M. Albro ------------------- 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