Skip to content

refactor(effs): share the audio ring through // @src - #949

Closed
This-Is-NPC wants to merge 1 commit into
bendlang:mainfrom
This-Is-NPC:refactor/effs-audio-ring
Closed

This-Is-NPC wants to merge 1 commit into
bendlang:mainfrom
This-Is-NPC:refactor/effs-audio-ring

Conversation

@This-Is-NPC

@This-Is-NPC This-Is-NPC commented Sep 21, 2026

Copy link
Copy Markdown

The C files for Audio.open, Audio.write and Audio.close each carried the same
157-line IO_RING block so any one of them compiled alone. The generated
program then pasted that block three times.

eff_src already skipped a path it had seen. A // @src name.c line now
loads a sibling through that same set, so the three effects share
audio_ring.c and a program that imports more than one still emits one
copy. A lone effect still compiles: it pulls the ring itself.

JS is unchanged (the silent stub has no ring). Isolated
tests/io/audio_open.bend passed interp, JS and C; the generated C has
#ifndef IO_RING once.

Repo: 545 → 231 lines in the audio effects, +2 in eff_src (−315 net).

audio_open/write/close C copied the same IO_RING block so each file
compiled alone. eff_src already dedupes a path; a // @src line lets
that seen-set include the ring, so a program that imports more than
one effect still emits one copy.
@VictorTaelin

Copy link
Copy Markdown
Contributor

Thank you for this. The same duplication is gone in 2.0.25 through PR #939, which reaches the one-copy result with the realpath dedup eff_src already has, so the compiler gains no new directive. Closing this one in favour of that; the diagnosis was right and the work is appreciated.

Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself.

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.

2 participants