From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 1C6E6BC0B for ; Tue, 16 Jan 2007 18:47:57 +0100 (CET) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [203.16.214.140]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0GHlqRS021569 for ; Tue, 16 Jan 2007 18:47:56 +0100 Received: from ppp27-234.lns1.syd6.internode.on.net (HELO rosella) ([59.167.27.234]) by ipmail01.adl2.internode.on.net with ESMTP; 17 Jan 2007 04:17:50 +1030 X-IronPort-AV: i="4.13,197,1167571800"; d="scan'208"; a="74706251:sNHT22900843" Subject: Re: [Caml-list] Ocaml compiler features From: skaller To: Vincent Hanquez Cc: caml-list@yquem.inria.fr In-Reply-To: <20070116150027.GA17519@snarc.org> References: <45A87011.8080203@gmail.com> <200701141823.32855.jon@ffconsultancy.com> <20070114184148.GA26213@snarc.org> <200701142049.57959.jon@ffconsultancy.com> <20070115000544.GA28731@snarc.org> <20070115221717.GA9982@snarc.org> <1168910291.9207.62.camel@rosella.wigram> <20070116090002.GA14494@snarc.org> <1168956872.5332.28.camel@rosella.wigram> <20070116150027.GA17519@snarc.org> Content-Type: text/plain Date: Wed, 17 Jan 2007 04:47:47 +1100 Message-Id: <1168969667.5178.18.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45AD0FC8.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 compiler:01 0100,:01 threads:01 extensively:01 compiler:01 threads:01 ocaml:01 generalise:01 finalisers:01 variants:01 sourceforge:01 garbage:01 wrote:01 caml-list:01 On Tue, 2007-01-16 at 16:00 +0100, Vincent Hanquez wrote: > Does you felix program have threads ? or lots of file descriptor ? or > has to stay up for a long period of time ? or use side effect quite > extensively ? > > Absolutely not, it's a compiler that doesn't need much of these stuff. > And even then, you can most of the time just rely on exit(3) to cleanup > since it's a short live service. Correct. > What about a server now ? add threads in the mix where all mutex need to > be properly unlocked, add also function with weird side effects that > don't have any representation variable at the OCaml level (thus cannot be > garbage collected), etc... What about it? C manages to handle all that .. and has no exceptions. > So please don't generalise your situation which is quite specific > (compiler) to the whole world of OCaml and open your mind to the fact > that people has different need/expectation. Try not to make assumptions about what people know. I've been programming for three decades. My mind isn't closed .. you just don't seem to get that what YOU think is common practice may actually not be. > (and that Felix doesn't have exceptions, I couldn't care less. OCaml > does and there are no going away, so live with it.) You missed the point. Neither C nor Felix have exceptions, and Ocaml can be programmed the same way. There's no need for finally if you program in an 'exception free' style. It may be convenient but your claim was that the need was 'common'. I doubt this. I DO agree exceptions, as structured now, are not so good. They're clumsy, hard to use, and dangerous (if not downright evil). But adding 'finally' may not be the best solution, the try/let construction looks better to me. > > Actually I'm a Python ex-guru, I have two major pieces > > of software written in it, and I've even *implemented* > > a Python interpreter .. in Ocaml :) > > Good for you. (interpreter still fall in the compiler category btw) The interpreter actually needed finalisation, since it used Ocaml GC instead of Python reference counting. In fact Ocaml finalisers were more or less added to Ocaml *because* my project provided a solid use case. In fact I have used Ocaml in a telco environment .. using the nice Event module, with many threads, services, and clients interacting in (soft) real time. That was some time ago so I can't say if I would have used 'finally' in that context or not. But typically I do that kind of thing the C way, which is generally the Ocaml way too: you propagate return codes from functions using variants up call chains. -- John Skaller Felix, successor to C++: http://felix.sf.net