On Sunday, 14 September 2025 at 02:50:42 UTC, Jonathan M Davis wrote:
Memory gets weird on top of that because of the desire to use the GC with pure functions and the argument that two objects with the same value are the same even though they're different places in memory (so whether they're really the same or not depends on what you're looking to guarantee). But even when a pure function returns a newly allocated object, every time that that function is called with the same arguments, the resulting object needs have the same value as any of the other calls. So, while the objects may not be the same objects in memory, they need to have the same value.

Thank you very much for the utterly comprehensive explanation. I think it cleared up any confusion that I had about this issue. The spec should probably clarify that allocating memory necessarily makes a function weakly pure.

Reply via email to