Skip to content

Instantly share code, notes, and snippets.

@belm0
belm0 / article_sc_and_lua_1.md
Last active September 21, 2023 06:37
Structured concurrency and Lua (part 1)

Structured concurrency and Lua (part 1)

John Belmonte, 2022-Sep

I've started writing a toy structured concurrency implementation for the Lua programming language. Some motivations:

  • use it as a simple introduction to structured concurrency from the perspective of Lua (this article)
  • learn the fundamental properties of structured concurrency and how to implement them
  • share code that could become the starting point for a real Lua library and framework

So what is structured concurrency? For now, I'll just say that it's a programming paradigm that makes managing concurrency (arguably the hardest problem of computer science) an order of magnitude easier in many contexts. It achieves this in ways that seem subtle to us—clearly so, since its utility didn't reach critical mass until around 2018[^sc_birth] (just as control structures like functions, if, and while weren't introduced to languages until long after the first compu

@tarleb
tarleb / lua-manual-cleanup.lua
Last active March 21, 2023 07:43
Lua filter to clean-up the Lua manual markup
-- There is no glyph for pi in the default font, but there is one in the
-- math font.
function Emph (e)
local s = e.content[1]
if #e.content == 1 and s.tag == 'Str' and s.text == 'π' then
return pandoc.RawInline('tex', '$\\pi$')
end
end
-- No glyph available for `≤` in the monospaced font.