# Would all objects in a reversible computing language be mutable?

Full disclosure, I'm asking this after watching a couple pop science videos; I do not know anything about the actual physics and hardware. I suspect the presenters expected an audience like me because they explained irreversibility at the level of a programming language ( irreversible_add(a, b) = a+b erases information; reversible_add(a, b) = (a, a+b) does not ) and simply said "reversibility must be at every level of abstraction".

Would such an irreversible programming language have to use mutable objects to avoid erasing information? In contrast, some programming languages treat primitive types as immutable, so a statement like a += 1 would create a new number, rebind the name a to that new number, and discard the old number. For example, this means reversible_add(a, b) = (a, a+b) would in fact discard the number bound to the name b.

Almost all sources that I have run across talk about reversibility at a hardware level (logic gates). I did find a source about immutable objects (strings) in a reversible programming language (Arrow), but reading it didn't answer my question.

No. For example,

c := a
d := a+b


avoids erasing information; but it does not use any mutable objects (c,d can be fresh variables that are assigned only once). It is not clear to me why you think that avoiding information erasure requires mutable objects, or what is the exact definition of an irreversible programming language.

• what does that line mean, exactly, I'm not familiar with the syntax Aug 16, 2021 at 4:18
• A bit funny, but the tuple unpacking was not the bit I was unsure about. Does this simply mean assignment to two new variables c and d? I ask because I've seen similar syntax for defining methods. Aug 16, 2021 at 4:22
• Ah ok. Now I hope to clarify my question. In my example, a and b are not persistent variables but argument names. So I'm imagining a function call c, d = reversible_add(1, 10). You start with two integer literals (1, 10) and the function returns (1, 11). So if we're working with immutable integers, 10 was created and discarded. Aug 16, 2021 at 4:34