---
title: "Rule 3.4: Textual structure and names in TypeShade"
description: "Rule 3.4 of the TypeShade language design, in Textual structure and names."
url: https://typeshade.dev/reference/rules/3-4/
language: en
---

# Rule 3.4

Chapter 3, Textual structure and names Test

A local variable, parameter, module constant or module variable that collides with a GLSL ES 3.00 identifier restriction must be renamed consistently by the GLSL writer; helper function renaming retains its existing behavior. A struct, field, override or binding whose GLSL spelling is reserved receives a planned GLSL spelling (Proposal 0070). The record of a binding or of an override carries that spelling as `emittedGlsl`, which equals `emitted` where the two spellings agree (Proposal 0151). The record of a struct or of a field carries `emitted` only (Proposal 0070, D3). No diagnostic is reported for such a name.

The rule text and the parts under it are the compiler's own English, as the design document writes them.

## Rationale

GLSL’s variable spellings can change without changing source values. The remaining names belong to interface or host contracts; GLSL is the second target: its spelling leaves the WGSL name as authored, and a GLSL word no longer stops the GLSL emit.

## Derives from

ANGLE at shader version 300, including the `gl_` prefix and `__` shape restrictions, and the shared `GLSL_ES300_RESERVED` authority.

## How it is verified

Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.

Where the rule says the compiler enforces it:

the GLSL spellings of the spelling plan (`planSpellings` in `src/core/spelling-plan.ts`), `sanitizeVariableNames` and `sanitizeReservedIdents` in `src/core/backends/glsl-sanitize.ts`, and `src/compiler/ts/reserved-names.test.ts`.

The files that verify it at commit af54ddad5, each at the first line that names the rule:

- [`src/compiler/ts/kernel-param-names.test.ts:2`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/kernel-param-names.test.ts#L2)
- [`src/compiler/ts/reserved-names.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/reserved-names.test.ts#L1)
- [`src/core/backends/glsl-sanitize.ts:22`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/glsl-sanitize.ts#L22)
- [`src/core/backends/glsl-spelling.test.ts:6`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/glsl-spelling.test.ts#L6)
- [`src/core/glsl-name-written.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/glsl-name-written.test.ts#L1)
- [`src/core/passes/variable-names.ts:2`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/variable-names.ts#L2)
- [`src/core/spelling-plan.ts:14`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/spelling-plan.ts#L14)

## See also

- [Rule 3.3](https://typeshade.dev/reference/rules/3-3/) Test
- [Rule 3.5](https://typeshade.dev/reference/rules/3-5/) Test
- [Design rules](https://typeshade.dev/reference/rules/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

The rule at commit af54ddad5:

- [`docs/language-design.md:282`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L282) (the design document)
- [`reqs/rules/RULE-0304.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0304.md) (its traceability item)
