From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA13649 for caml-redistribution; Tue, 1 Jun 1999 17:17:33 +0200 (MET DST) 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 OAA03210 for ; Mon, 31 May 1999 14:42:33 +0200 (MET DST) Received: from mailhub4.isdnet.net (mailhub4.isdnet.net [195.154.209.24]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id OAA28282 for ; Mon, 31 May 1999 14:42:30 +0200 (MET DST) From: hubert.fauque@wanadoo.fr Received: from debian.castelnau.fr (ppp43-montpellier.isdnet.net [195.154.5.170]) by mailhub4.isdnet.net (8.9.3/8.9.3) with ESMTP id OAA78603 for ; Mon, 31 May 1999 14:42:27 +0200 (CEST) Received: from hubert by debian.castelnau.fr with local (Exim 2.11 #1 (Debian)) id 10oROW-0000mB-00; Mon, 31 May 1999 14:42:20 +0200 To: caml-list@inria.fr Subject: Re: Typing-problem References: In-Reply-To: aXl's message of "Sun, 30 May 1999 17:24:50 +0200 (MET DST)" User-Agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.3 Date: 31 May 1999 14:42:20 +0200 Message-ID: <87d7zh2yxf.fsf@debian.castelnau.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: weis aXl writes: > Hi, > why is in the following example b of type "string -> string" ? because a is of type string->string and b=a > > let a = id id;; > let b = a;; > a "foo";; > (* until here it's covered by the faq's *) > b;; let b = a defines a new name (b) for the object designed by a; it doesn't construct a new object, and it doesn't do a new call (id id); it is different from let a = id id;; let b = id id;; The Caml let ..= .. is different from the assignment in C or Pascal; in C if you write a=b; there is a variable "a" which already as a place in memory, and a=b means: copy the memory location of b to a; in Caml let defines a new name; it's the right of the = which may construct a new object; that's why let a = id id let b = a is different from lat a = id id let b = id id Hubert hubert.fauque@inria.fr