docs(lang): keyword-spelled f32/f64 still need a backtick in member-name positions [F0.6]

The member-name exemption applies only to identifier-classified reserved
spellings (s1..s64, u1..u64, bool, string, void, usize, isize, Any). f32/f64
are lexer keywords (token.zig kw_f32/kw_f64) and member-name slots require an
identifier token, so a bare f32/f64 field/tag/method name is rejected at parse;
the backtick is required there too. specs.md + readme.md corrected.
This commit is contained in:
agra
2026-06-04 22:42:09 +03:00
parent d14e29be02
commit 685d3d122b
2 changed files with 14 additions and 1 deletions

View File

@@ -38,6 +38,15 @@ and `` obj.`s2 `` both resolve. The exemption covers member *signatures* only: a
slot), so a reserved-spelled impl method still needs the backtick
(`` `s2 :: (self) ``), exactly like a free function. See `examples/0158`.
The bare member-name exemption applies only to the **identifier-classified**
reserved spellings — `s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`, `usize`,
`isize`, `Any` — which all lex as ordinary identifiers. The two
**keyword-classified** reserved spellings, `f32` and `f64`, are lexer keywords, and
member-name slots require an identifier token; a bare `f32` / `f64` is therefore
rejected at parse (`expected field name in struct`) even in a member position. Use
the backtick there too — `` struct { `f32: s64; } `` / `` union { `f64: … } `` /
`` protocol { `f32 :: (self); } `` work as field / tag / method names.
```sx
s2 := 2.5; // ERROR: 's2' is a reserved type name and cannot be used as an identifier
s2 :: 5; // ERROR — a `::` constant name is a binding site too