Elektrine lite

← Feed

@joe@f.duriansoftware.com

Post #2167160

2026-05-07 16:43 UTC

@zwarich@hachyderm.io i'm not sure about the specifics, or whether they actually followed through on anything, but there was talk about special handling `Result` returns IIRC. since they don't have a uniform single-pointer error repr, i don't think the swift trick would work as is in swift land, there are folks who would like to be able to recover from fatal errors, like for servers, test runners, etc. maybe panics are one of those things where the cat is always on the wrong side of the door

Replies (1)

  • @joe@f.duriansoftware.com 2026-05-07 20:24

    @zwarich@hachyderm.io maybe you could have the caller reserve stack space for the error, and then do the Swift trick of having a normally callee-save register that is either null on no error or takes on the sret address if an error is thrown. you'd waste the stack space in the no-error case, but it shouldn't cost the caller anything extra to reserve in addition to the rest of its own stack frame. and if the normal return is also indirect, you could share the stack slot for either the normal or error result

    Open ##2177627