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:
@@ -114,7 +114,11 @@ function declaration, an `impl` method definition, or a `::` type declaration
|
||||
positions are exempt**: a struct *field*, a union *tag*, and a protocol
|
||||
*method-signature* may be a bare reserved spelling (`struct { s2: s64 }`,
|
||||
`union { u8: … }`, `protocol { s2 :: (self) }`) — they are reached via `obj.name`,
|
||||
so they never mis-lower. A leading backtick escapes one into a **raw identifier**:
|
||||
so they never mis-lower. The bare exemption covers only the identifier-classified
|
||||
reserved names (`s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`, `usize`,
|
||||
`isize`, `Any`); `f32` and `f64` are lexer keywords, so even in a member slot they
|
||||
need the backtick (`` struct { `f32: s64 } ``). A leading backtick escapes one into
|
||||
a **raw identifier**:
|
||||
`` `name `` is the literal identifier `name` (the backtick drops out of the text),
|
||||
usable in **every** position — value, declaration, and type, and optional in the
|
||||
exempt member positions. It is the only way handwritten sx can spell a reserved
|
||||
|
||||
Reference in New Issue
Block a user