RFC-007 Speaker Patterns
RFC 007: Speaker Patterns
Section titled “RFC 007: Speaker Patterns”Status: Draft Date: 2026-02-01 Topics: Entities, DSL Design, Developer Experience
1. Summary
Section titled “1. Summary”This RFC compares two competing patterns for defining speakers in Vyasa: the Generic Pattern (speaker[Name]) and the Explicit Entity Pattern (Name as a command). It analyzes the trade-offs and proposes a recommendation for different workspace types.
2. The Contenders
Section titled “2. The Contenders”A. Generic Pattern
Section titled “A. Generic Pattern”Used in intimate-note. The speaker is an argument to a generic command.
`speaker[Dhritarashtra] `uvacha [ ... ]- Pros:
- Zero Auto-Configuration: No need to pre-define “Dhritarashtra” in
context.vy. - Namespace Cleanliness: Does not pollute the global command namespace.
- Extensible: Authors can introduce new speakers on the fly.
- Zero Auto-Configuration: No need to pre-define “Dhritarashtra” in
- Cons:
- Verbosity: High friction for scripts with frequent dialogue (e.g., plays, Gita).
- Validation: Harder to catch typos (
speaker[Dritarashtra]) at compile time unless an enum constraint is individually applied.
B. Explicit Entity Pattern
Section titled “B. Explicit Entity Pattern”Used in bhagavad-gita. The speaker is a first-class command.
`Dhritarashtra `uvacha [ ... ]- Pros:
- Conciseness: extremely low friction for dialogue-heavy texts.
- Readability: Reads like a natural script.
- Validation: Typos (
Dritarashtra) are compile-time errors (Unknown Command).
- Cons:
- Configuration Heavy: Every speaker MUST be defined in
context.vy(command-def { name="Dhritarashtra" ... }). - Namespace Pollution: Large casts can crowd the command space.
- Configuration Heavy: Every speaker MUST be defined in
3. Analysis
Section titled “3. Analysis”Contextual Suitability
Section titled “Contextual Suitability”| Feature | Generic Pattern | Explicit Entity Pattern |
|---|---|---|
| Use Case | Narratives, infrequent quotes, one-off speakers. | Plays, Scripts, Dialogues (Gita, Shakespeare). |
| Setup Cost | Low | High |
| Authoring Speed | Medium | High |
| Validation | Loose (unless validated against list) | Strict (Schema-driven) |
The “Uvacha” Interaction
Section titled “The “Uvacha” Interaction”Both patterns interact with the uvacha (action) command.
- Generic: The template must inspect the
speakercommand’s argument to determine the specific header (e.g., “dhṛtarāṣṭra uvāca”). - Explicit: The template inspects the
node.cmditself.
4. Recommendation
Section titled “4. Recommendation”Vyasa should support both, but recommend them for different domains.
Recommendation A: The “Script” Profile
Section titled “Recommendation A: The “Script” Profile”For workspaces that are primarily dialogue (Gita, Upanishads, Plays):
- Use Explicit Entity Pattern.
- Define all characters in
context.vyor distinct.vydefinitions. - Reason: The friction reduction for the author outweighs the setup cost.
Recommendation B: The “Prose” Profile
Section titled “Recommendation B: The “Prose” Profile”For workspaces that are primarily narrative (Bible, Novels, Articles):
- Use Generic Pattern (
speakerorqalias). - Reason: Speakers appear ad-hoc; defining them all is overkill.
5. Implementation Impact
Section titled “5. Implementation Impact”No compiler changes are required to support either. This is purely a pattern choice for context.vy configuration and Template logic.