Rule 1.4
On this page

Rule 1.4

Chapter 1, Introduction Test

Where ECMAScript has a form that carries the GPU meaning, the surface must borrow TypeScript’s spelling; a WGSL spelling is borrowed only where no ECMAScript spelling carries the meaning, and the borrowing must keep every WGSL capability reachable (Rule 11.14). A form may be borrowed in part: the members, the positions or the meaning it takes are those the rules give it. A WGSL capability that only switches off a validation the compiler satisfies by rewriting the program is not borrowed: the compiler’s rewrite gives the program the capability would have admitted. The derivative_uniformity filter is such a capability (Rule 8.5). Its rows in docs/capability-coverage.md are refused with this rule (Rule 11.14, Rule 11.18).

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

Rationale

the WGSL vocabulary is there to say what TypeScript cannot say, such as a value’s width or an address space. It is not a second spelling an author has to learn for what TypeScript already says. A filter that switches a validation off is not something the author must state: it asks the author to learn a WGSL rule name and its severities for work the compiler can do, and the program it leaves is indeterminate in WGSL and undefined in GLSL ES 3.00. The language keeps a construct only for what the author must state and the compiler cannot know (docs/owner-decisions.md, OD-3).

Derives from

changes/0100-typescript-meaning.md (section 1, the first two requirements); the roadmap’s first rule, “ordinary TypeScript first”; changes/0132-remove-diagnostic.md (decision 6) and OD-3 for the third sentence.

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:

review (Rule 13.1); Appendix B, under Rule 1.1, for the spellings the tree still offers twice; the rows’ cells in src/core/coverage/wgsl.ts, checked by capability-coverage.test.ts (Rule 11.18); TS8028 on a written @diagnostic(…) or { diagnostic: [...] }, and the tests of Rule 8.5’s rewrite.

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

Explained in

The sections of the surface document that explain this rule, at commit af54ddad5:

Error codes that enforce it

The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:

TS8028 ATTRIBUTE_NAME
A decorator or an entry form that this surface does not read: an identifier outside the attribute vocabulary (@vertex, @fragment, @compute, @builtin, @location), such as a misspelled @vertx; a WGSL attribute that the surface writes another way or does not borrow, such as a written @diagnostic(…); a stage written as a call, such as vertex(f); an entry that is written in a form that Rule 8.1 refuses, such as export default; or a decorator on a declaration or in a place that takes none (Rule 6.7). Without this code the decorated function or field would silently stop being an entry point or an I/O field.

See also

Source

The rule at commit af54ddad5:

Edit this page Report a problem