mutable records

Iavor S. Diatchki diatchki@cse.ogi.edu
Tue, 03 Sep 2002 10:00:13 -0700


hi,

Manuel M T Chakravarty wrote:
 > ...
> Having said this, there are not that many situations where
> you need to do this (and in consequence ST-monadify your
> program).  Purely functional updates (using the record
> syntax) where the system effectively copies the whole record
> (not all data in it, just the references to that data) is
> perfectly suitable in most cases.  If you are concerned
> about efficiency first profile the code to see whether the
> performance bottleneck is really where you think it is.

one situation in which i find mutable fields easier to use
rather than pure updates is if the record is deep into another data 
structure (e.g. a list of records).  modifying a record than becomes a 
hassle as one has to remove it from the list, create the new record,
and then insert it in the list.  this is particularly inconvinient if 
the order of the records in the list actually matters.

bye
iavor


-- 
==================================================
| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================