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 QAA04187; Tue, 21 Oct 2003 16:29:23 +0200 (MET DST) 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 QAA09591 for ; Tue, 21 Oct 2003 16:29:22 +0200 (MET DST) Received: from aomori.annexia.org (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h9LETM109871 for ; Tue, 21 Oct 2003 16:29:22 +0200 (MET DST) Received: from rich by aomori.annexia.org with local (Exim 3.36 #1 (Debian)) id 1ABxVh-0001mb-00 for ; Tue, 21 Oct 2003 15:29:21 +0100 Date: Tue, 21 Oct 2003 15:29:21 +0100 To: caml-list@inria.fr Subject: [Caml-list] OCaml wishlist Message-ID: <20031021142921.GA6736@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i From: Richard Jones X-Loop: caml-list@inria.fr X-Spam: no; 0.00; wishlist:01 camlp:01 wishlist:01 'return':99 foo:01 indented:01 camlp:01 hash:01 hashtbl:01 hash:01 foo:01 freshmeat:01 ltd:98 ocaml:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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. This is particularly a concern with writing basically imperative UI code. Is it possible to do something like this with camlp4? (as a stopgap - I still think it should go into the language) 2. abstract data type syntactic sugar: let hash = Hashtbl.create 16 in hash#add "foo" 10; or: hash->add "foo" 10; hash#add "bar" 20; or: hash->add "bar" 20; The syntactic sugar is that if a module contains a type called M.t (literally "type t"), and obj has type M.t, then: obj#call [ or: obj->call ] is exactly equivalent to: M.call obj I think this change would help a lot of Java programmers () who would otherwise tend to jump immediately on using objects, which are an area where OCaml is weaker. What do other people think? Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you. All new technology is irrelevant until it is taken up by the public. ------------------- 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