mastodon.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
The original server operated by the Mastodon gGmbH non-profit

Administered by:

Server stats:

383K
active users

the people require __attribute__((__musttail__)) in gcc. we require it

@wingo oh yes, that would be excellent

@cfbolz @wingo Tangential, but one of the tricky things I sometimes think about is how to reconcile tail-call optimisation with debuggability. Do you have a take?

E.g. with tail recursion, even supposing you can reconstruct the stack depth and locals from ambient other state, it's not expressible within DWARF to 'synthesise n frames, computed like so'... and it'd probably be a misfeature even if it were. What should happen?

Sibling tail-call opt is even trickier... I often tell it to -f off.

@stephenrkell @cfbolz @wingo Many years ago I wrote a blog post on the downsides of tail calls on debugging tratt.net/laurie/blog/2004/tai only to discover later that at least one paper (Smith and Ungar, cited at the end in an update) had also alluded to the problem. I've sometimes wondered: how soon after tail calls were introduced did the debugging downsides become known?

tratt.net Laurence Tratt: Tail Call Optimization
Andy Wingo

@ltratt @stephenrkell @cfbolz i think in this concrete case there is no issue because it's something the programmer intends, rather than an unexpected optimization. would be weird to see a stack frame when you explicitly asked not to have one :)

@wingo @stephenrkell @cfbolz I agree -- when one opts in to TCO, one implicitly accepts the lack of stack traces.

@ltratt @stephenrkell @cfbolz ok gotta be pedantic here, what is being opted into is proper tail calls, not tail call *optimization*; clang::musttail means tail calls even when -O0

@wingo @ltratt @cfbolz Time for my pedantry... let's not mix 'stack traces' (a debugging feature) with 'stack frame' (a memory allocation). Stack traces already include 'frames' that do not correspond to any physical frame, thanks to inlining

(That is another example of something that can be done at -O0, via always_inline, and straddles 'correctness' vs 'optimisation'. For TC[O] it depends whether you classify asymptotic space usage as functional or extrafunctional... the use case matters.)

@stephenrkell @wingo @ltratt to me, a musstail call is really exactly like a goto or a while loop. It's not comparable at all to an inlined call, or really any kind of call at all. It just happens to syntactically look like one for accidental reasons. I (would) use it to implement looping in an interpreter.