HN Debrief

LuaJIT 3.0 proposed syntax extensions

  • Programming
  • Developer Tools
  • Open Source
  • Infrastructure

The post is a GitHub proposal for LuaJIT 3.0 syntax extensions. It is not about optimizer internals or VM changes. It is about surface language features. The list includes ternary syntax, `+=` style compound assignment, safe navigation like `?.`, nil coalescing, symbolic boolean operators such as `&&` and `||`, bitwise operators, string interpolation, `continue`, and shorter anonymous function forms. Some of those already exist in newer PUC Lua versions or in Luau, while others are closer to JavaScript, C, or Ruby conventions.

If you embed Lua or depend on Lua portability, plan for a wider gap between LuaJIT and PUC Lua rather than convergence. The practical question is no longer just performance, but which dialect you are willing to lock your tooling, plugins, and hiring to over the next few years.

Discussion mood

Cautiously interested, but mostly skeptical of the broad syntax sweep. People liked specific ergonomic fixes like compound assignment, nil coalescing, and safe navigation, but many saw symbolic operators and ternary syntax as unnecessary churn that pushes LuaJIT further away from portable Lua.

Key insights

  1. 01

    If expressions are not cheap sugar

    Turning `if` into an expression sounds more Lua-like than `?:`, but it is not a cosmetic swap. Lua would need a rule for how branch bodies produce values, and that pulls in deeper choices about block semantics, parsing, and whether expressions can stand where statements do. The clean-looking alternative is really a language model change, not just friendlier syntax.

    Treat any `if`-expression proposal as a larger compatibility and implementation decision than ternary syntax. If you maintain parsers, linters, or alternate runtimes, budget for semantic fallout, not just token-level changes.

      Attribution:
    • drunken_thor #1
    • Heliodex #1
    • boomlinde #1
    • wavemode #1
    • Joker_vD #1 #2
  2. 02

    LuaJIT is still anchored to Lua 5.1

    A lot of confusion came from people reading these proposals as if LuaJIT were simply catching up to current Lua. It is not. LuaJIT diverged from the PUC line years ago, and that split was tied to real implementation and compatibility choices around 5.2-era changes, not simple neglect. That makes every new feature proposal a fork governance question, not a backlog cleanup task.

    Do not assume future LuaJIT code will naturally converge on modern PUC Lua. If portability matters, define your supported dialect explicitly and test against it early.

      Attribution:
    • omoikane #1
    • orthoxerox #1 #2
    • matheusmoreira #1
    • fsfod #1
    • radiator #1
  3. 03

    Tooling and package compatibility matter more

    For people actually shipping embedded Lua, the pain point is less missing syntax than mismatched ecosystems. Better LuaRocks compatibility and less friction with PUC Lua would do more for day-to-day developer experience than extra spellings for operators. New syntax is easy to notice, but package and runtime compatibility is what determines whether teams can adopt code without forking it.

    If you are evaluating Lua for plugins or embedded scripting, spend more time on dependency and runtime compatibility than on syntax preference. The operational cost shows up in packages, not in whether the language has `+=`.

      Attribution:
    • drunken_thor #1
    • coneonthefloor #1
    • Ardren #1
    • pseudony #1
  4. 04

    Lua’s fake ternary is the real pressure

    The strongest pro-ternary argument was not aesthetics. It was that Lua developers already reach for `a and b or c`, and that pattern is wrong whenever the middle value can be `false` or `nil`. A real conditional expression removes a well-known footgun that has trained users into writing clever but subtly incorrect code.

    If your Lua codebase uses `and/or` as a ternary stand-in, audit those cases now. Even if LuaJIT adds new syntax later, the current idiom can hide correctness bugs today.

      Attribution:
    • 201984 #1
    • matheusmoreira #1
    • nmz #1
    • bawolff #1
  5. 05

    Luau is shaping the syntax agenda

    Some proposals make more sense once you view Luau as a reference point rather than JavaScript. Luau has already tested the market for Lua-5.1-compatible extensions, especially around ergonomics, and a generation of younger developers has seen that dialect first. That creates pressure for LuaJIT to borrow from Luau where it can, even if it does not want Luau’s bigger moves like native type annotations.

    If you hire developers coming from Roblox, or you use code generation tools trained on public Lua-like code, Luau compatibility is becoming a practical concern. Watch which Luau features LuaJIT adopts, because that will shape onboarding and tool output.

      Attribution:
    • orthoxerox #1
    • krapp #1
    • Heliodex #1
  6. 06

    LuaJIT is not deployable everywhere

    Several people pushed back on the casual assumption that LuaJIT has effectively replaced Lua. It has not, because many targets either disallow JIT techniques outright or make them awkward, including app-store environments and WebAssembly targets. LuaJIT does have fast interpreters on some architectures, but the deployment envelope is still narrower than standard Lua.

    Choose LuaJIT for environments you control. If your product has to run on iOS, consoles, WebAssembly, or locked-down app-store platforms, validate deployment constraints before you commit to the LuaJIT path.

      Attribution:
    • sourcegrift #1
    • latenightcoding #1
    • Boxxed #1
    • extrememacaroni #1
    • Dylan16807 #1

Against the grain

  1. 01

    Modern syntax could help adoption

    The pro-change case was straightforward. Lua’s semantics are already small and learnable, so adding familiar surface syntax can lower friction without changing the core model much. For people coming from JavaScript, C-like languages, or Luau, these proposals make LuaJIT feel less like a niche historical dialect and more like a practical language you can recommend today.

    If your main bottleneck is onboarding rather than portability, syntax familiarity may be worth more than language purity. Teams standardizing on LuaJIT internally can rationally prefer the more familiar dialect.

      Attribution:
    • pansa2 #1
    • orthoxerox #1
    • childintime #1
    • JSR_FDED #1
    • larrry #1
  2. 02

    Fragmentation may be normal for Lua

    Not everyone bought the claim that divergence is uniquely harmful here. Lua often lives as an embedded language pinned inside a host application for years, so ecosystem-wide convergence matters less than host stability. From that view, LuaJIT freezing one line and Luau growing another is not failure. It is how the Lua world adapts to very different product constraints.

    If you embed Lua in a product with a long support horizon, optimizing for your host’s stability can be more important than tracking a common language center. Pick a dialect intentionally and expect to own that choice for a long time.

      Attribution:
    • kzrdude #1
    • klibertp #1
    • camgunz #1

In plain english

compound assignment
Short syntax such as `+=` that updates a variable by combining reading and writing in one operator.
JIT
Just-in-time compilation, a technique that compiles code while a program runs to improve performance.
LuaJIT
A high-performance implementation of the Lua programming language that includes a just-in-time compiler and its own extensions.
LuaRocks
The main package manager and distribution system for Lua libraries.
Luau
A Lua-derived language developed by Roblox that adds features such as static typing and extra syntax while staying close to Lua 5.1.
nil coalescing
An operator that returns a fallback value when the main value is missing or null-like.
PUC Lua
The reference implementation of Lua maintained by the language’s original team at Pontifical Catholic University of Rio de Janeiro.
safe navigation
Syntax that accesses a field or calls a method only if the object exists, avoiding an error on null-like values.
ternary
A conditional expression with three parts, usually written like `condition ? if_true : if_false`.
WebAssembly
A portable binary format used to run code in browsers and other sandboxed environments.

Reference links

Proposal and compatibility references

Language design and syntax precedents

Alternative Lua syntaxes and tools

  • LJS
    An alternate syntax front end targeting Lua, offered as proof that custom syntax can live above the VM.
  • ljsjit
    A related project adapting the alternate syntax approach to LuaJIT.
  • lua2ljs converter
    A converter from Lua syntax to LJS syntax, cited as an existing syntax-translation tool.
  • omnilua
    A Rust implementation aiming to support Lua 5.1 through 5.5 in one binary.
  • omnilua performance dashboard
    Provided to answer questions about runtime and memory overhead versus C Lua.

Packaging and deployment references

  • Cosmopolitan
    Suggested as a way to bundle Lua applications into a single portable executable with a thin C wrapper.

Lua ecosystem examples