규칙 1.8
이 페이지에서

규칙 1.8

1장, 소개 테스트

A construct of the language is written in the language’s own syntax: the directive, a type of the surface, or an attribute @name or @name(…) on the declaration it marks. A construct that marks a function, its stage or its dispatch is an attribute @name or @name(…) on the function’s declaration. A construct that describes a value that flows into or out of an entry (an entry’s parameter, a field of an entry I/O struct, an entry’s result) or a binding is part of its type. A construct must not be written as a call of a function whose only role is to carry it. A construct exists only for what the author must state and the compiler cannot know or prove; an optimization the compiler can prove exact, a tuning parameter and a validation the compiler can satisfy by rewriting the program are the compiler’s work. Where the compiler chooses a tuning parameter by default, an attribute may let the author state it explicitly, as @workgroup_size([n]) does for a kernel (Rule 8.22): the default is the compiler’s choice, and the attribute is an override, never a requirement. TypeShade borrows TypeScript’s syntax and is not TypeScript: whether a TypeScript tool (tsc, a formatter, a linter, a bundler) accepts a form is not a criterion for the surface, and the tooling for the language’s own syntax is the project’s work, as it is for Vue single-file components and JSX.

규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

근거

a "use typeshade" file is a program in the TypeShade language, and its own compiler and language service read it (Rule 3.1). A call of a fixed function name presents a construct as a library API. Change 0111 D1 measured the surface against a plain tsc and replaced @vertex with vertex(f); later revisions of change 0130 measured it against prettier, typescript-eslint, esbuild and Bun and proposed to infer the stage. The owner rejected both criteria on 2026-11-09. The owner decided on 2026-11-09 that an entry’s I/O stays in the type (docs/owner-decisions.md, OD-5). OD-5 also says that an object is passed with no qualifier (Rule 8.8). Rule 1.4 still holds where an ECMAScript form carries the meaning; a call whose only role is to mark its argument does not carry it. Rule 1.7 holds: the language service keeps an attribute as a form TypeScript parses, drops TypeScript’s grammar report on it, and checks its content with the compiler’s own check of that form. docs/roadmap.md’s first rule, “ordinary TypeScript first”, reads as: borrow TypeScript’s spelling for what TypeScript can say, and write the rest in the language’s own syntax.

출처

changes/0130-stage-attributes.md; the owner’s direction of 2026-11-09; change 0137; OD-5.

검증 방식

테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.

컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.

review (Rule 13.1); the independent review of each proposal (changes/README.md); TS8028 ATTRIBUTE_NAME on a stage call (refuseStageCalls in src/compiler/ts/stage-call.ts), pinned in both halves by src/compiler/ts/stage-call.test.ts.

커밋 af54ddad5에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.

설명하는 절

커밋 af54ddad5의 언어 문서에서 이 규칙을 설명하는 절입니다.

적용하는 오류 코드

규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.

TS8028 ATTRIBUTE_NAME
이 표면이 읽지 않는 데코레이터나 진입점 형태입니다. 속성 어휘(@vertex, @fragment, @compute, @builtin, @location) 밖의 식별자(@vertx 같은 오타), 표면이 다른 방식으로 쓰거나 빌려 오지 않는 WGSL 속성(직접 쓴 @diagnostic(…) 같은 것), vertex(f)처럼 호출로 쓴 스테이지, export default처럼 규칙 8.1이 거부하는 형태로 쓴 진입점, 데코레이터를 받지 않는 선언이나 자리에 붙은 데코레이터가 그렇습니다(규칙 6.7). 이 코드가 없으면 데코레이터를 붙인 함수나 필드가 아무 말 없이 진입점이나 IO 필드가 아니게 됩니다.

함께 보기

소스

커밋 af54ddad5의 규칙 원문:

이 페이지 편집 문제 보고