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 TAA08373; Tue, 1 Jun 2004 19:55:29 +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 TAA08197 for ; Tue, 1 Jun 2004 19:55:28 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i51HtPSH028833 for ; Tue, 1 Jun 2004 19:55:26 +0200 Received: from [192.168.1.200] (ppp114-11.lns1.syd3.internode.on.net [150.101.114.11]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i51HtJk2015102; Wed, 2 Jun 2004 03:25:20 +0930 (CST) Subject: Re: [Caml-list] Strange syntax behavior From: skaller Reply-To: skaller@users.sourceforge.net To: John Goerzen Cc: caml-list In-Reply-To: <20040601171354.GA16495@excelhustler.com> References: <20040601171354.GA16495@excelhustler.com> Content-Type: text/plain Message-Id: <1086112519.16811.149.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 02 Jun 2004 03:55:19 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40BCC30D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 bug:01 misleading:01 terminator:01 endmatch:01 verbose:01 obstacle:01 precedences:01 typedefs:01 emitter:01 9660:01 glebe:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 2004-06-02 at 03:13, John Goerzen wrote: > Is this a bug or a feature? If a feature, why is this so? the > try..with behavior seems highly misleading. This is a consequence of a lot of the syntactic elements being prefix form, that is, having no trailing terminator: if/then/else and try/with and let/in and match/with are all like this, whilst while/do/done and for/do/done are terminated. Prefix forms have to have a definite precedence. No choice is always what you want. Felix uses closed constructions mainly so you have to write: if/then/else/endif and match .. endmatch etc. [Except i had to allow let/in .. :] Whilst this is more obvious than the Ocaml syntax, it does make heavily nested expressions more verbose. Summary: a fairly arbitrary choice. Use begin/end around try/with if in doubt. You will get used to it. However it is a bit of an obstacle to learning Ocaml: after, what, 8 years Ocaml programming I still have no idea what the precedences of everything are. And I have no idea how to read C type declarations after 20+ years .. I just use typedefs .. it was interesting to write a parser/emitter for them recently, I actually almost learned the C rules.. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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