Re: Fragmented arrays?

John Reppy <[email protected]> Tue, 19 Jan 2010 16:27:27 -0600
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
SML is not a "pure" functional language, but the type system distinguishes between mutable
and immutable values.

	- John

On Jan 19, 2010, at 11:40 AM, Jon Loldrup wrote:

> 
> 2010/1/19 John Reppy <[email protected]>
> I'm not sure what you are getting at.  Arrays support update in place, so at the machine-level, the
> update operation is just a store instruction (plus any write-barrier overhead required by the GC).
> 
>        - John
>  
> 
> I think I see where the confusion lies. I believe(d) that even referenced values (eg. arrays) were immutable.
> 
> If they are immutable:
> When updating a cell in such an array, one would have to write only the new content of that celle to memory. Else, it wouldn't be constant time. That again would mean that the new content would be placed somewere outside the existing array (as we are not allowed to overwrite the existing array). This means that the new array (semantically: the old array modified with the new value) would physically be fragmented.
> 
> If they are mutable:
> Well then theres no problems with constant time read and write - they would not fragment the array.
> 
> 
> A local SML-expert told me that referenced values were immutable, and that if they weren't, it would be a hazard for the purity of the functional parts of the program, as a reference passed around as a parameter would ruin the promise that a function has no side effect.
> 
> 
> /Jon
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for Conference
> attendees to learn about information security's most important issues through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev_______________________________________________
> Smlnj-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/smlnj-list


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev