Problem
The default parse stack applies ResolveStringReferencesMiddleware. An entry such as journal = journalName therefore becomes the current literal value of @string{journalName = ...}. Writing the parsed library emits the expanded value and loses the relationship to the macro definition.
That is not merely formatting normalization: later edits to the @string definition no longer update the entry, and a parse/write cycle creates many duplicated literals. The original reference cannot be reconstructed reliably from the expanded text.
Proposed default
Remove ResolveStringReferencesMiddleware from the default parse stack so references remain references. Keep the middleware public and document an explicit dereferencing profile:
layers = [
ResolveStringReferencesMiddleware(),
RemoveEnclosingMiddleware(),
]
Ordering matters because interpolation must see the original expression before ordinary enclosure removal changes its representation.
Add public-entry-point tests proving both contracts:
- default parsing and writing retain
@string linkage; and
- callers who explicitly request interpolation receive expanded values.
Compatibility
This is a user-visible default change. Existing users who rely on immediate expanded values must add the middleware explicitly. The alternative is irreversible semantic loss during ordinary parse/write use, so preservation is the safer default for a bibliography codec.
Concatenated expressions and cyclic/unresolved references are related to #396 but are not prerequisites for deciding the default. The initial implementation should use basic references and remain independently reviewable.
Problem
The default parse stack applies
ResolveStringReferencesMiddleware. An entry such asjournal = journalNametherefore becomes the current literal value of@string{journalName = ...}. Writing the parsed library emits the expanded value and loses the relationship to the macro definition.That is not merely formatting normalization: later edits to the
@stringdefinition no longer update the entry, and a parse/write cycle creates many duplicated literals. The original reference cannot be reconstructed reliably from the expanded text.Proposed default
Remove
ResolveStringReferencesMiddlewarefrom the default parse stack so references remain references. Keep the middleware public and document an explicit dereferencing profile:Ordering matters because interpolation must see the original expression before ordinary enclosure removal changes its representation.
Add public-entry-point tests proving both contracts:
@stringlinkage; andCompatibility
This is a user-visible default change. Existing users who rely on immediate expanded values must add the middleware explicitly. The alternative is irreversible semantic loss during ordinary parse/write use, so preservation is the safer default for a bibliography codec.
Concatenated expressions and cyclic/unresolved references are related to #396 but are not prerequisites for deciding the default. The initial implementation should use basic references and remain independently reviewable.