Version française
Home     About     Download     Resources     Contact us    
Browse thread
Type annotations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: qrczak@k...
Subject: Re: Ref syntax
Thu, 21 Dec 2000 14:50:38 +0200 (IST), Ohad Rodeh <orodeh@cs.huji.ac.il> pisze:

>   I have a modest syntax request as we are approaching
> the release of OCaml-3.01. Currently, if x is a
> reference, one must use the assignment operator (:=) to
> update it. Can array assignment (<-) be used also? 

It would be inconsistent. With <- the same "level of deredeferencing"
is on both sides: "r.x <- r.x" is legal. With := the lhs is a reference
and rhs is a dereferenced value, and the identity assignment is "x := !x".

The only consistent syntax would be "!x <- new_contents_of_x". Note
that the revised syntax uses "x.val <- new_contents_of_x", with x.val
being equivalent to old !x on both sides of <- and without the need
of any magic syntax for references in addition to what is available
anyway for mutable fields.

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK