Changes between Version 1 and Version 2 of Language/Overview/DestructiveUpdate
- Timestamp:
- 06/17/10 02:36:10 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Language/Overview/DestructiveUpdate
v1 v2 29 29 {{{ 30 30 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 }}} 33 33 34 34 Values of `Point` type are constructed in the standard way, and we can use the field names to access their components. … … 64 64 In the previous example, when we used `(#)` a reference was created which held a pointer ''into'' the `point` object. 65 65 {{{ 66 (point # x) :: Ref Float66 (point # x) :: Ref Float 67 67 }}} 68 68 69 69 The `(#=)` operator is just a regular function which has type: 70 70 {{{ 71 (#=) :: forall a. Ref a -> a -> ()71 (#=) :: forall a. Ref a -> a -> () 72 72 }}} 73 73 74 74 When we then evaluated: 75 75 {{{ 76 point#x #= newX76 point#x #= newX 77 77 }}} 78 78 The pointer inside `point` which used to reference `oldX` was updated to reference to `newX`.
