Skip to content

One shared inert-region mechanism (quote, discard, comment forms) instead of per-language checks #357

Closed

Description

@joyful-ii-V-I

Part of the language-architecture cleanup tracked in #354 ("common stays common").

Problem. "Calls inside quoted or commented-out code are not calls" is one idea, written per language: Elixir quote do … end (elixirQuoted in src/ingest_elixir.h), and in #349 Clojure's '/`/#_ (clojureQuotedOrDiscarded), soon also Clojure (comment …) blocks.

Change. One shared inert-region mechanism: either a capture in the shared vocabulary (e.g. @inert in tags.scm) or one per-language hook with a single call site. References inside an inert region mint no call edges and are counted, not silently dropped.

Acceptance. A gate, red first, with a quoted-call fixture for Elixir (and Clojure once #349 lands); every other language byte-identical.

Size: 0.5–1 day. Comment here to claim it.

Activity

  1. LaimaWu commented on Oct 4, 2026

    @LaimaWu
    Contributor

    Hi — I’d like to take this one. I’ll start with the red gate for the existing Elixir quoted-call behavior, then work toward the shared inert-region mechanism while keeping the other language outputs byte-identical. I’ll post back here if the current architecture suggests the scope needs adjustment before opening a PR.

  2. joyful-ii-V-I commented on Oct 4, 2026

    @joyful-ii-V-I
    CollaboratorAuthor

    Thanks for picking this up, @LaimaWu, and for planning red gate first and checking scope before the PR. That's exactly how we like these to land. A few pointers from what we know of the code, all optional:

    1. Inert regions have live holes. From a quick read of elixirQuoted (src/ingest_elixir.h), it treats anything with a quote ancestor as inert, including what sits inside unquote(...) / unquote_splicing(...). But an unquoted expression is evaluated when the macro expands, so quote do foo(unquote(bar(x))) end really does call bar/1. Clojure has the same shape: ` (syntax-quote) with ~ / ~@ holes, while ' and #_ have none. A shared mechanism that models "inert region, except re-entry nodes" would get both right. It's worth a red arm either way: a call inside unquote(...) within quote must still be an edge. If today's behaviour drops it, that's a real fix this issue gets to claim.

    2. Prefer data over a hook if the predicates allow it. #355 is moving per-language keyword tables into tags.scm predicates, and #374 plans a per-language hook table in captureTagsFacts. An @inert capture (plus a re-entry capture for the holes) keeps the next language's quote/comment forms as data. If a hook turns out simpler, a single call site that #374's table can absorb later is fine too.

    3. Counted, not silently dropped. As the issue says, references inside an inert region should show up in a count (header gauge or --report, wherever declined= lives today), so an answer like "no callers" can be honest about calls that exist only in quoted or commented-out code. A negative arm should prove the count moves.

    4. Near-miss negatives worth having in the gate:

    • a function named quote or comment that isn't the special form;
    • quote with an option (quote bind_quoted: [...] do);
    • nested quote inside unquote inside quote;
    • a call immediately after the inert region ends.

    5. Byte identity. Non-Elixir maps must be byte-identical. The goldens plus a before/after map diff and --clones on a few repos is what we check (see #354). For Clojure, #349 isn't merged yet, so a TODO arm, or a follow-up once it lands, is perfectly fine.

    6. Pins. Main is at kParserVer 143. Other changes in flight will take the next numbers, so use the next free value and note "train renumbers". We'll set the final number when it lands.

    Shout here if anything about the current structure looks off. Happy to answer questions.

  3. LaimaWu commented on Oct 5, 2026

    @LaimaWu
    Contributor

    Thanks — this is really helpful, especially the “inert region with re-entry nodes” framing. I’m working through the red-gate cases now, including unquote(...) / unquote_splicing(...) inside quoted regions and the corresponding Clojure cases.

    I’ll report back once I have the failing/passing cases pinned down before touching the implementation.

  4. added a commit that references this issue on Oct 17, 2026
    30b52b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions