Elektrine lite

← Feed

@joe@f.duriansoftware.com

Post #2165141

2026-05-07 16:07 UTC

@zwarich@hachyderm.io yeah that's how metaware's c compiler did generators back in the day, they were implemented as nested functions, so they were strictly scoped and you could nonlocal jump up out of them but not back in, nor reify the ongoing context "error with an optimized ABI" seems like a good way to go. if it weren't for pesky return branch prediction it would be cool to experiment with multiple return addresses so you didn't need to have a caller-side branch after every call

Replies (2)

  • @joe@f.duriansoftware.com 2026-05-07 16:10

    @zwarich@hachyderm.io you could do both unwinding and special ABI like rust is trying to, in order to accommodate panics or other pervasive semi-recoverable failures. but it sounds like a lot of the rust ecosystem is trending toward `panic=abort` as their favored policy? (and of course in C++ land everyone already does -fno-exceptions)

    Open ##2165273

  • @zwarich@hachyderm.io 2026-05-09 15:17

    @joe@f.duriansoftware.com I went back and looked at the Metaware docs you posted. I'm somewhat impressed by how many problems are solved by just using their "CPS transform with nested functions" approach. The problem with doing straightforward shallow generators is that it's a pain to get recursive traversals of data structures, but it falls out naturally from their approach. What I'm still unclear about is the natural compiler IR for representing/optimizing such a language.

    Open ##2420319