[External] : Re: Question about circular references

David Alayachew davidalayachew at gmail.com
Mon Jul 3 23:22:09 UTC 2023


Hello Ron,

Thank you for your response!

> 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.

And thank you for the clarification. This makes much more sense.

In that case, this inability in the reference-following way is actually the
part that I am taking issue. I am saying that this inability is a problem.
The purpose of my original post was to say that I think this ia a problem,
and I want to see if anyone else thinks it is too. The fact that it is not
representable, imo, limits us from being able to more accurately write
programs that correctly model the domain we're building for.

> 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.

I understand you now. You are essentially saying that in Java, this is
simply not representable because of the way OOP and references work in
Java. And this is the part that I am taking issue with and querying the
crowd for.

> 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)

I would agree. Mutable tuples have a use, but I don't see enough benefit
for them atm. And either way, it does not solve my problem since
immutability is what I need in order for my model to truly be accurate.

But what are your thoughts on my post? Do you think this lack of
representability is a problem too?

Thank you for your time and help!
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230703/0fe9b57a/attachment-0001.htm>


More information about the amber-dev mailing list