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 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 95AADBC69 for ; Tue, 2 Oct 2007 21:35:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAK42AkfLENaMn2dsb2JhbACONgEBAQEHBAYHCBg X-IronPort-AV: E=Sophos;i="4.21,221,1188770400"; d="scan'208";a="2030514" Received: from ipmail01.adl2.internode.on.net ([203.16.214.140]) by mail1-smtp-roc.national.inria.fr with ESMTP; 02 Oct 2007 21:35:54 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAK42Akd5LHvc/2dsb2JhbAAM X-IronPort-AV: E=Sophos;i="4.21,221,1188743400"; d="scan'208";a="202767900" Received: from ppp121-44-123-220.lns10.syd6.internode.on.net (HELO [192.168.1.201]) ([121.44.123.220]) by ipmail01.adl2.internode.on.net with ESMTP; 03 Oct 2007 05:05:52 +0930 Subject: Re: [Caml-list] best and fastest way to read lines from a file? From: skaller To: kirillkh Cc: caml-list@yquem.inria.fr In-Reply-To: References: <779bf2730710011427g5983da4cw6ad8b715a9e38771@mail.gmail.com> <47016CEE.8010704@crans.org> <200710021239.l92CdwZ15641@virtutech.se> <47024002.2080206@janestcapital.com> Content-Type: text/plain Date: Wed, 03 Oct 2007 05:35:51 +1000 Message-Id: <1191353751.6668.47.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; 0200,:01 delimited:01 suck:98 sourceforge:01 polymorphic:01 polymorphic:01 wrote:01 exception:01 exception:01 compiles:01 caml-list:01 exceptions:01 exceptions:01 int:01 match:02 On Tue, 2007-10-02 at 20:02 +0200, kirillkh wrote: > Replying to a private mail from Brian: > (* I couldn't figure out, how to declare a polymorphic exception > properly *) > exception Done of 'a That's easy -- you can't: even if you could, how could you possibly use it? This compiles fine: type t = { field : 'a. 'a } exception Done of t but 'field' is useless. This is not at all the same as let f (x:'a) (g:'a -> int) = match g x with | 0 -> .. | .. because *inside* the function, 'a is not a type variable, and the code is not polymorphic, it is simply a sole unknown type, sometimes said to be monomorphised. The problem with exceptions is that they're not captured, so they cannot be polymorphic. Exceptions SUCK because their context is not delimited -- you can throw all the way out of the mainline .. :) [This happens to me regularly and it can takes days to figure out what is Not_found ..] -- John Skaller Felix, successor to C++: http://felix.sf.net