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 RAA04874; Tue, 21 Oct 2003 17:00:19 +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 RAA17455 for ; Tue, 21 Oct 2003 17:00:18 +0200 (MET DST) Received: from nemerle.org (lilith.ii.uni.wroc.pl [156.17.4.7]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h9LF0H112281 for ; Tue, 21 Oct 2003 17:00:17 +0200 (MET DST) Received: from malekith by nemerle.org with local (Exim 4.24) id 1ABxzX-0001rv-OF; Tue, 21 Oct 2003 17:00:12 +0200 Date: Tue, 21 Oct 2003 16:55:31 +0200 From: Michal Moskal To: Richard Jones Cc: caml-list@inria.fr Subject: Re: [Caml-list] OCaml wishlist Message-ID: <20031021145531.GA14086@roke.freak> Mail-Followup-To: Richard Jones , caml-list@inria.fr References: <20031021142921.GA6736@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031021142921.GA6736@redhat.com> User-Agent: Mutt/1.4.1i X-PGP-Fingerprint: CF89 1B14 11BE 1CC9 2CA3 7497 5E32 69B4 BC71 B4C2 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; michal:01 moskal:01 malekith:01 pld-linux:01 caml-list:01 wishlist:01 camlp:01 wishlist:01 'return':99 foo:01 indented:01 michal:01 moskal:01 malekith:01 kernel:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Oct 21, 2003 at 03:29:21PM +0100, Richard Jones wrote: > After writing a fair bit of OCaml in commercial situations (although > I'm by no means an expert, and really should learn camlp4), here's my > wishlist: > > 1. 'return' from a function. eg: > > let foo x = > if x < 0 then return "OSL"; > (* long & complex code *) > return "some other string" > > I know I can do this using if ... else, but when you have multiple > levels of if ... else you end up being indented so far across the > screen as to make coding unpleasant. You can try guarded patterns. I have to admit that OCaml makes imperative programming somewhat harder then it strictly have to. This is however religious issue. > 2. abstract data type syntactic sugar: > obj#call [ or: obj->call ] > > is exactly equivalent to: > > M.call obj let f a b c = a->add b c What type does f have? -- : Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv : When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h ------------------- 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