Skip to content

engine: three look-alike separator characters are written as literals #565

Open

Description

@bpowers

Identifiers use three separator characters that look almost the same in an editor and in a diff:

Char Codepoint Meaning Example
⁚ U+205A stdlib model prefix and engine-made helper names stdlib⁚delay1, $⁚ltm⁚agg⁚0
· U+00B7 module path after parsing (canonicalize converts . to it) module·output
. ASCII module path in the saved model module.port

Using the wrong one compiles and fails quietly as a name that matches nothing.
Code should use named constants instead of literals.

Example

#567 was a real case: model.rs split a parsed module path on ASCII ., so the split never matched.
That code has since been deleted.

Why it matters

Production code writes the literals by hand in many places.
Across src/simlin-engine/src, ⁚ appears about 3,400 times in 100 files and · about 1,500 times in 111 files, most of them in tests.
Some constants already exist, but each in its own module: datamodel::STDLIB_PREFIX, a private MODULE_SEPARATOR in patch.rs, and a private QUALIFIER in patch_dimensions.rs.

Fix

Define one public constant per separator in common.rs and use it in non-test code where a separator is built or split.
Leave literals in tests, where the expected string is clearer written out.

Alternative: separate types for parsed and saved-model identifiers, so mixing them is a compile error.
Stronger, but far more churn.
The original idea of a test that scans the source for stray literals is not worth it given how many legitimate literals there are.

Pointers

  • src/simlin-engine/src/common.rs: canonicalize
  • src/simlin-engine/src/datamodel.rs: STDLIB_PREFIX
  • src/simlin-engine/src/patch.rs: MODULE_SEPARATOR
  • src/simlin-engine/src/capture.rs: synthetic_ident

Activity

  1. added
    engine
    hygiene
    on Jun 8, 2026
  2. changed the title [-]engine: three visually-indistinguishable separator chars (U+205A / U+00B7 / ASCII .) are load-bearing across stdlib + macro subsystems with no type-level or lint guard[/-] [+]engine: three look-alike separator characters are written as literals[/+] on Oct 12, 2026
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

    enginehygiene

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions