Skip to content

9.2: the shared glue — python_glue<Host>, for tap.python and tap.python~ - #47

Merged
tap merged 2 commits into
mainfrom
v2/shared-glue
Oct 9, 2026
Merged

tap merged 2 commits into
mainfrom
v2/shared-glue

Conversation

@tap

@tap tap commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Plan item 9.2 (docs/TAP-PYTHON-PLAN.md): what tap.python~ does on the Max side that tap.python (9.3) needs too now lives in one place, templated on the host object.

What moved

  • tap.python_glue.h (new, beside the object) holds:
    • python_attr<Host>, python_message<Host> and python_members<Host>. Together they cover the attributes and messages made for a class, keeping them in step across reloads, attribute get/set, and the guard (answered_by_max).
    • The C trampolines, instantiated per host type as python_glue<Host>. Each one finds its object through Host::self().
    • Moved in from the object: start_runtime(), watch_source(), to_values(), found_method() / not_found_method(), and the console hooks.
    • reserved_messages(audio), which now takes the audio names as a parameter (audio_messages()).
  • tap.python_tilde_{attribute,message,cglue}.h are folded into it and deleted.
  • tap.python_tilde_{filewatch,package}.h are renamed to tap.python_{filewatch,package}.h, since both objects use them.
  • tap.python_tilde.cpp loses its hand-written trampolines.

Why it's a pure move

  • tap.python~ reserves the same 53 names in the same order (checked against main). Its errors and console text are the same strings.
  • The glue test changes only two call sites (found_method, not_found_method). One new scenario pins what an audio object reserves beyond what every object reserves.
  • The data-import check is unaffected: the external imports no CPython data symbols.
  • The guard's comment now matches what 9.0 found: an attribute answers its name, but a message added with object_addmethod() does not.
  • style.yml's clang-tidy header filter now covers tap.python_tilde/tap.python*, so the glue headers stay in scope.

For 9.3

reserved_messages(false) still includes anything, which comes from 8.2's list. The plan says tap.python exposes a class's anything, so 9.3 needs to take it out of that object's list and add dumpout.

Verified (macOS 15, Max 9.1.5)

  • Glue test: 10 cases, 138 assertions; ctest green
  • clang-format (pre-commit) and clang-tidy-18, using CI's commands with the widened filter
  • nm: no CPython data imports
  • runtime-tests/run.py: every runtime test passes in Max, including attributes-and-messages (22 assertions), which goes through the new trampolines

🤖 Generated with Claude Code

https://claude.ai/code/session_019rVV9SkjkWmiBXFMT4whkz

tap and others added 2 commits October 9, 2026 16:15
… for tap.python too (9.2)

The attribute, message and trampoline headers fold into tap.python_glue.h, beside the object:
python_attr<Host>, python_message<Host> and python_members<Host> (the attributes and messages
made for a class, their reconciliation on reload, attribute access, and the guard), with the C
trampolines instantiated per host type through Host::self(). Starting the runtime, the file
watch, atom conversion, found_method()/not_found_method() and the console hooks move there from
the object; reserved_messages() takes the audio names as a parameter (audio_messages()). The
file watcher and package headers lose their _tilde (tap.python_filewatch.h,
tap.python_package.h), as both objects use them.

A pure move: tap.python~'s list of reserved names is the same 53 in the same order, its messages
and errors read the same, and its glue test is unchanged but for two call sites, plus a scenario
pinning what an audio object reserves beyond every object's. The guard's comment now says what
9.0 found: an attribute answers its name, a message added with object_addmethod() does not.
style.yml's clang-tidy header filter widens to the glue headers.

Verified: the glue test (10 cases), clang-format, clang-tidy-18, no CPython data imports, and
every runtime test in Max 9.1.5 on macOS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019rVV9SkjkWmiBXFMT4whkz
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019rVV9SkjkWmiBXFMT4whkz
@tap
tap merged commit f55984c into main Oct 9, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant