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 JAA19699; Fri, 7 Jun 2002 09:58:02 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA19693 for ; Fri, 7 Jun 2002 09:58:01 +0200 (MET DST) Received: from maild.telia.com (maild.telia.com [194.22.190.101]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g577w1n22331 for ; Fri, 7 Jun 2002 09:58:01 +0200 (MET DST) Received: from d1o903.telia.com (d1o903.telia.com [195.252.34.241]) by maild.telia.com (8.11.6/8.11.6) with ESMTP id g577w0H29628; Fri, 7 Jun 2002 09:58:00 +0200 (CEST) Received: from [212.181.190.135] (t6o903p15.telia.com [212.181.190.135]) by d1o903.telia.com (8.8.8/8.8.8) with ESMTP id JAA02015; Fri, 7 Jun 2002 09:57:58 +0200 (CEST) User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022 Date: Fri, 07 Jun 2002 10:02:16 +0200 Subject: Re: [Caml-list] look operator From: Winfried Dreckmann To: Pixel CC: =?ISO-8859-1?B?gA==?= caml list Message-ID: In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk on 06.06.2002 12:58 Uhr, Pixel at pixel@mandrakesoft.com wrote: > => "look" is only used for efficiency? couldn't the compiler achieve > the same result without using an unsafe construct? Yes, only for efficiency, see Michel Quercia's reply. As you point out, there are other ways to do the same thing which are safe but cost too much. >> Using "look", every single >> function with arguments of type t, say >> >> val add_in : tref -> t -> t -> unit, >> >> replaces two or more functions which would otherwise be necessary, in this >> case >> >> val add_in1 : tref -> t -> t -> unit >> val add_in2 : tref -> tref -> t -> unit >> val add_in3 : tref -> tref -> tref -> unit > > are you saying that i would be nice to have this? As far as i have > looked at numerix, it doesn't have this. No, I'm saying that "add_in" together with "look" has the same functionality as the three functions below. I find this quite elegant, if there were no safety issues with "look". >> My question to the caml list: Would you accept such constructions as decent >> Caml programming, if applied carefully and only in cases where it allows >> what is otherwise impossible (e. g. integrating mutable and non-mutable >> objects as it is done in "numerix"). Or is it all just a silent >> reintroduction of C pointers, and principally a bad thing? > > I don't think this will never be in OCaml! > (but i may be prooved wrong :) Right so! But with the C interface you can program such constructions anyway. I wouldn't see a problem at all if all unsafety is hidden from the user. However, in the case of "look" in the "numerix" library a certain amount of unsafety is left to the user. This is unsatisfactory. Michel Quercia describes some ideas to solve this problem in his letter. Thanks for the link. Winfried Dreckmann ------------------- 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