Post #3613079
2025-12-29 19:47 UTC
@zwarich@hachyderm.io @foonathan@fosstodon.org @dotstdy@mastodon.social @ianh@mastodon.social yeah return value emplacement was the other thing i had in mind where a tuple (in its naive unexploded representation) isn't the same thing as multiple values.
even with first-class borrows, the way swift tries to allow for tuples to be magically exploded and imploded by the implementation fights against the very concept of a borrow-of-tuple ever existing, since you really want a contiguous representation for that borrow to refer to
Replies (1)
-
@zwarich@hachyderm.io 2025-12-29 19:55
@joe@f.duriansoftware.com @foonathan@fosstodon.org @dotstdy@mastodon.social @ianh@mastodon.social Another funny realization is that if all return values are returned by writing to a passed reference, then you could have functions with no actual return values and only out-params (with the appropriate pointer type that must be written before returning). It's the use of resources like registers (which may be implicitly used by other code in the function) that necessitates presenting a value at the point of return. You could take this to the next level and actually have out-params that "steal" registers when written to, but at that point you're probably in meme language territory.