[MLton] Re: [Smlnj-dev-list] Evolving SML
Robert Harper
rwh@cs.cmu.edu
Tue, 25 Oct 2005 23:13:43 -0400
i agree with this view. the individual fields should not be
independent "l-values" (to borrow old terminology), and in particular
should never alias. treating a mutable record as a ref to a record
(for which there is a functional update operation for fields) seems to
be the right thing. so much so, in fact, that i don't see why it
should be a primitive notion at all!
bob
On Oct 25, 2005, at 10:31 PM, John Reppy wrote:
> Do you mean the semantics or implementation of equality? The
> semantics are
> fairly straightforward: just make equality on records with mutable
> fields be
> pointer equality. In fact, I would argue that refs should be viewed as
> syntactic sugar for a record with one mutable field.
>
> If you want to view mutable fields as a derived form (at least
> formally),
> then I'd argue for a ref of a record (not a record of refs). The fact
> that individual fields cannot be shared with other data structures is
> important.
>
> - John
>
> On Oct 25, 2005, at 4:18 PM, Peter Sestoft wrote:
>
>> On Tue, 25 Oct 2005, John Reppy wrote:
>>
>>
>>> Here are a few ideas for short-term (and medium-term) features that
>>> I'd like to see:
>>>
>>
>>
>>> 7. records with mutable fields.
>>>
>>
>> Preferably this should be syntactic sugar for a records with ref
>> fields. OCaml-style updatable records, while useful, would require a
>> redesign of equality because updates can create cycles...
>>
>> Peter
>>
>>
>