[External] : Re: Question about circular references

Ron Pressler ron.pressler at oracle.com
Mon Jul 3 22:59:13 UTC 2023


When I said that immutability is not the issue I meant that there can be immutable cyclic graphs — so immutability isn’t the thing preventing them — but you can’t have tuples (and tuples are also immutable) directly represent a cyclic graph (in the reference-following sense). Again, tuples/records can represent arbitrary graphs in the standard mathematical way by representing edges, but not in the direct “OOP” reference-following way.

Put another way, you can have an immutable reference-based representation of a cyclic graph, but not one that’s directly made of records (which are also obviously immutable). Records are simple immutable data, but not every simple immutable data structure is directly representable by records.

Because there can be immutable cyclic graphs I said that it’s not immutability that’s the issue. (Whether or not we can talk of mutable tuples is a separate matter; I would say no, at least not in the most rigorous sense)



> On 3 Jul 2023, at 23:35, David Alayachew <davidalayachew at gmail.com> wrote:
> 
> 
> Hello Ron,
> 
> Thank you for your response!
> 
> > The issue is not immutability
> 
> So let me reiterate what I said to Vicente -- I did not and do not take issue with records being immutable. Immutability is a good thing, and I did not and do not want that to go away.
> 
> > While records represent simple data, not all simple data
> > can and should be directly represented as records.
> > Records are specifically tuples (i.e. product types), and
> > cyclic data structures are not tuples.
> 
> ???
> 
> The dictionary definition of "product type" disagrees with you, correct? Let me post a snippet of the definition here.
> 
> "In programming languages and type theory, a product of types is another, compounded, type in a structure. The "operands" of the product are types, and the structure of a product type is determined by the fixed order of the operands in the product. An instance of a product type retains the fixed order, but otherwise MAY CONTAIN ALL POSSIBLE INSTANCES OF ITS PRIMITIVE DATA TYPES."
> 
> "If there are only two component types, it can be called a "pair type". For example, if two component types A and B are THE SET OF ALL POSSIBLE VALUES OF THAT TYPE, the product type written A × B contains elements that are pairs (a,b), where "a" and "b" are instances of A and B respectively."
> 
> Am I misreading this? Because even after multiple readings of it, the definition seems clear, obvious, and in direct contradiction to what you are saying. What am I missing here?
> 
> > The issue is[...]that tuples do not
> > represent cyclic data, at least not directly 
> 
> Again, I am struggling to see where you pulling this logic and definition from. It seems counter to what everyone else calls a product type or a tuple.
> 
> Here is another snippet.
> 
> "In type theory a product type of two types A and B is the type whose terms are ordered pairs (a,b) with a:A and b:B."
> 
> "In a model of the type theory in categorical semantics, this is a product. In set theory, it is a CARTESIAN PRODUCT. In dependent type theory, it is a special case of a dependent sum."
> 
> Help me out here.
> 
> Thank you for your time!
> David Alayachew
> 



More information about the amber-dev mailing list