Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: hubert.fauque@wanadoo.fr
To: caml-list@inria.fr
Subject: Re: Typing-problem
Date: 31 May 1999 14:42:20 +0200	[thread overview]
Message-ID: <87d7zh2yxf.fsf@debian.castelnau.fr> (raw)
In-Reply-To: aXl's message of "Sun, 30 May 1999 17:24:50 +0200 (MET DST)"

aXl <krauth@fmi.uni-passau.de> 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




      parent reply	other threads:[~1999-06-01 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-30 15:24 Typing-problem aXl
1999-05-31 10:37 ` Typing-problem Jean-Christophe Filliatre
1999-05-31 12:42 ` hubert.fauque [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d7zh2yxf.fsf@debian.castelnau.fr \
    --to=hubert.fauque@wanadoo.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox