Changes between Version 1 and Version 2 of Language/Overview/DestructiveUpdate

Show
Ignore:
Timestamp:
06/17/10 02:36:10 (5 years ago)
Author:
benl (IP: 129.94.242.38)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Language/Overview/DestructiveUpdate

    v1 v2  
    2929{{{ 
    3030 instance Show Point where 
    31      show (Point x y)   = parens (show x % "," % show y)         
    32 }}} 
     31     show (Point x y)   = parens (show x % "," % show y) 
     32}}} 
    3333 
    3434Values of `Point` type are constructed in the standard way, and we can use the field names to access their components. 
     
    6464In the previous example, when we used `(#)` a reference was created which held a pointer ''into'' the `point` object. 
    6565{{{ 
    66         (point # x) :: Ref Float 
     66(point # x) :: Ref Float 
    6767}}} 
    6868 
    6969The `(#=)` operator is just a regular function which has type: 
    7070{{{ 
    71         (#=) :: forall a. Ref a -> a -> () 
     71(#=) :: forall a. Ref a -> a -> () 
    7272}}} 
    7373 
    7474When we then evaluated: 
    7575{{{ 
    76         point#x #= newX 
     76point#x #= newX 
    7777}}} 
    7878The pointer inside `point` which used to reference `oldX` was updated to reference to `newX`.