Rule 2.4
Chapter 2, Sources of the surface Test
An ECMAScript name that has a WGSL meaning must lower to that meaning, and an ECMAScript name that has no WGSL meaning is still an ECMAScript name, whatever the backend expands it to.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
Math.cbrt is what a TypeScript author writes; that WGSL has no cbrt is the compiler’s problem and does not make cbrt a TypeShade invention.
Derives from
Numeric Built-in Functions for the names that exist there; src/compiler/ts/math-alias.ts for the mapping.
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:
surface-names.test.ts (the Math and console stand-ins declare only members the real ones have).
The files that verify it at commit 26de7be8, each at the first line that names the rule:
See also
- Rule 2.3 Test
- Rule 3.1 Test
- Design rules
- Error codes
Source
The rule at commit 26de7be8:
docs/language-design.md:130(the design document)reqs/rules/RULE-0204.md(its traceability item)