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 BAA07761; Sun, 9 Feb 2003 01:17:28 +0100 (MET) 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 BAA07769 for ; Sun, 9 Feb 2003 01:17:27 +0100 (MET) Received: from nexus.stwing.upenn.edu (NEXUS.STWING.UPENN.EDU [165.123.132.61]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h190HQf05518 for ; Sun, 9 Feb 2003 01:17:26 +0100 (MET) Received: from force.stwing.upenn.edu (daemon@force.stwing.upenn.edu [165.123.132.65]) by nexus.stwing.upenn.edu (8.11.6/8.11.6) with ESMTP id h190HNb13205 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified NO); Sat, 8 Feb 2003 19:17:24 -0500 (EST) Received: (from wlovas@localhost) by force.stwing.upenn.edu (8.11.6/8.11.6) id h190HNa23715; Sat, 8 Feb 2003 19:17:23 -0500 (EST) Date: Sat, 8 Feb 2003 19:17:23 -0500 From: William Lovas To: caml-list Cc: altavillasalvatore@libero.it Subject: Re: [Caml-list] ref Message-ID: <20030209001722.GA23643@force.stwing.upenn.edu> Mail-Followup-To: caml-list , altavillasalvatore@libero.it References: <3E459B7A.5000207@baretta.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3E459B7A.5000207@baretta.com> User-Agent: Mutt/1.4i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, Feb 09, 2003 at 01:06:18AM +0100, Alessandro Baretta wrote: > > > altavillasalvatore@libero.it wrote: > > >f,g := a; > >!f, !g ;; > > You are asking too much of the assignment operator. You must > remember that Ocaml does not support operator overloading, > so you cannot define a > val (:=) : 'a ref -> 'a -> unit > > and a > val (:=) : ('a * 'b) ref -> ('a * 'b) -> unit > > This would require a form of "generic overloading" of (:=) > over all tuple types. This is really a little too much, I think. I think you mean for your second example to be: val (:=) : ('a ref * 'b ref) -> ('a * 'b) -> unit What you originally wrote, val (:=) : ('a * 'b) ref -> ('a * 'b) -> unit , is just a more specific instance of val (:=) : 'a ref -> 'a -> unit . The original poster could accomplish his goal with something like: let (a1,a2) = a in f := a1; g := a2; !f, !g;; but ... > BTW, are you sure you need references? ... i agree that this is probably the right question to be asking :) cheers, William ------------------- 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