tangential to the primary discussion, but i think i'm probably still missing something because in that example the generic type seems like it is used within the default argument function (granted, as a side-effect). if T were not referenced within the default argument function, could it be treated as if it were a 'regular' rvalue expression (and therefore not be delayed)?
ah, i see, thank you for elaborating. certainly interested to hear more about how we might do this (could opening occur more than once when evaluating the arguments?), though it does somewhat deflate my hopes that there would be a 'simple' solution here (perhaps something along the lines of the original idea would still be an acceptable short-term approach?).
this discussion has made me wonder: is there actually a 'formal' answer to how Swift evaluates arguments? i've searched a bit but found no clear, definitive answer/documentation. the 'left-to-right' rule seems oft-cited, but clearly that's not the whole story. the fact that default arguments are evaluated after rvalues was surprising to me, despite nearly a decade of using the language... is even that behavior explicitly spelled out anywhere?
edit: heh, it seems my past self also wondered about this...