Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: WatchDog <watchdog@free.fr>
To: caml <caml-list@inria.fr>
Subject: [Caml-list] Question sur les références.
Date: Fri, 28 Dec 2001 15:20:57 +0100	[thread overview]
Message-ID: <3C2C7FC9.86AD1CA3@free.fr> (raw)

Bonjour ! Cette petite fonction me pose des problèmes :

let resultat (a,b,c,d) position =
    let pos=ref position in
  !pos.(d).(c) <- !pos.(b).(a) ; !pos.(b).(a) <- V ;
!pos ;;

Quel ne fut pas mon étonnement en constatant que cette fonction se
permettait de modifier le contenu même de position, alors que je ne l'ai
utilisé qu'avec une référence (pos) qui pointait dessus !
Quand on écrit
let x = ref 1 in x := !x + 1;;
ça ne modifie pas la valeur de l'entier 1, non ???
Merci de votre éclairage.

--
"Il faut résister, combattre, affronter la mort.
 Ainsi l'exige la vérité, la raison."
    Jean CAVAILLES


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2001-12-28 14:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-28 14:20 WatchDog [this message]
2001-12-28 15:36 ` hubert.fauque
2001-12-28 16:18   ` WatchDog
2001-12-28 17:27     ` hubert.fauque
2001-12-29 16:54       ` [Caml-list] lablGL and GLUT Christophe Raffalli
2001-12-30  8:15     ` [Caml-list] Re: [Caml-list] Question sur les références Alan Schmitt
2001-12-30 11:05       ` Daniel de Rauglaudre
2002-01-01 11:20         ` [Caml-list] " Alan Schmitt
2001-12-28 15:45 ` Daniel de Rauglaudre

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=3C2C7FC9.86AD1CA3@free.fr \
    --to=watchdog@free.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