Keyword-named instance members are unreachable via qualified access #38

Open
opened 2026-07-03 00:40:57 +00:00 by toph · 0 comments
Owner

A def body may bind --map = through .p .q (member names are ordinary identifiers), but --[$i map] is a syntax error — map lexes as the MAP keyword, and the member position in .[$i m] / --[$i m] only accepts IDENT. Same for as, cross, step, through, etc.

Either accept keywords in member position (the grammar is unambiguous there — between $i and ]) or document that member names must avoid keywords and reject them at binding time inside def bodies. Silently unreachable members are the worst of the three options.

Follow-up to #35.

A def body may bind `--map = through .p .q` (member names are ordinary identifiers), but `--[$i map]` is a syntax error — `map` lexes as the `MAP` keyword, and the member position in `.[$i m]` / `--[$i m]` only accepts `IDENT`. Same for `as`, `cross`, `step`, `through`, etc. Either accept keywords in member position (the grammar is unambiguous there — between `$i` and `]`) or document that member names must avoid keywords and reject them at binding time inside def bodies. Silently unreachable members are the worst of the three options. Follow-up to #35.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch#38
No description provided.