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.1 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 54BAABC6C for ; Wed, 27 Jun 2007 17:39:07 +0200 (CEST) Received: from looneymail-a5.g.dreamhost.com (lax-green-bigip-5.dreamhost.com [208.113.200.5]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5RFd6hx006615 for ; Wed, 27 Jun 2007 17:39:06 +0200 Received: from [192.168.101.117] (unknown [66.84.219.53]) by looneymail-a5.g.dreamhost.com (Postfix) with ESMTP id EE01C122C21 for ; Wed, 27 Jun 2007 08:38:48 -0700 (PDT) Message-ID: <46828488.3000006@SmokejumperIT.com> Date: Wed, 27 Jun 2007 10:38:48 -0500 From: Robert Fischer Organization: Smokejumper Consulting User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] The Implicit Accumulator: a design pattern using optional arguments References: <200706271314.35134.jon@ffconsultancy.com> <1A1D6F56-B3DB-4552-969C-9859482175AC@lrde.epita.fr> <200706271453.06045.jon@ffconsultancy.com> <200706271528.l5RFSKF04408@virtutech.se> In-Reply-To: <200706271528.l5RFSKF04408@virtutech.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 4682849A.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; compile-time:01 enforces:01 mattias:01 hashtbl:01 hashtbl:01 val:01 accessor:01 inlined:01 beginner's:01 ocaml:01 bug:01 equality:01 equality:01 beginners:01 wrote:01 I don't have a top-level with me right now, so I'm shooting from the hip, but I don't think it is a compile-time error to attempt to use the referential equality operator on two different types. If I'm right, then you will want a separate is-equals function that wraps the referential equality check and enforces type safety. Robert Fischer IT Firefighter Smokejumper Consulting Mattias Engdegård wrote: >> # let symbol = >> let m = Hashtbl.create 1 in >> fun string -> >> try Hashtbl.find m string with Not_found -> >> Hashtbl.add m string string; >> string;; >> val symbol : '_a -> '_a = >> > > Nice, but perhaps it should return a different type to avoid accidentally > comparing an interned string with a non-interned one? > > We would need an accessor to extract the string from an abstract type but > I suppose that would be inlined. > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >