---
title: "규칙 9.9: 내장 함수와 TypeShade 확장, TypeShade 셰이더 언어 설계 규칙과 그 근거"
description: "TypeShade 언어 설계 규칙 9.9(내장 함수와 TypeShade 확장)입니다. A WGSL built-in function, an overload of one…"
url: https://typeshade.dev/ko/reference/rules/9-9/
language: ko
---

# 규칙 9.9

9장, 내장 함수와 TypeShade 확장 테스트

A WGSL built-in function, an overload of one, or a §9.3 name must not be authorable when an ECMAScript spelling the compiler supports carries every case it accepts with the same meaning ([Rule 1.4](https://typeshade.dev/ko/reference/rules/1-4/)). A call or a read of a removed name must be refused in one sentence that names the ECMAScript spelling: `arrayLength was removed: write xs.length.` A name stays when a case only it carries is the reason, and the reason is recorded: `TAU` (neither ECMAScript nor WGSL has it), `select` (the bool-vector mask), the WGSL math names (the vector forms), `any(v)` and `all(v)` on a bool or a bool vector, `mod`, `fill`, `zip`, `discard` and `random`.

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

## 근거

a second spelling of a meaning is a thing to learn and not a thing to use ([Rule 1.4](https://typeshade.dev/ko/reference/rules/1-4/)). The test asks one question of each name: does an ECMAScript spelling carry every case this name accepts, with the same meaning? `xs.length` carries every case of `arrayLength`, `Math.log10` of `log10`, `xs.reduce((a, b) => a + b)` of `sum` (the same unrolled additions in the same order), `xs.some(p)` and `xs.every(p)` of the `any` and `all` folds, `!xs.some(p)` of `none`, and `**` of `pow` over a scalar and a vector alike. A removed program stops compiling with its fix in the sentence ([Rule 12.1](https://typeshade.dev/ko/reference/rules/12-1/)), which [Rule 13.10](https://typeshade.dev/ko/reference/rules/13-10/) allows before `1.0.0`, since it does not compute something else.

## 출처

[Rule 1.4](https://typeshade.dev/ko/reference/rules/1-4/); `changes/0112-one-spelling.md` (sections 1 to 3), which measured each row on both halves; the roadmap’s first rule, “ordinary TypeScript first”.

## 검증 방식

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

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

- `src/compiler/ts/removed-names.test.ts`, which reads each removed spelling and its replacement on both halves, `compile()` and the language service’s `getDiagnostics`, on one source: the code and the sentence of the refusal ([`TS8004`](https://typeshade.dev/ko/reference/errors/ts8004/) for a call, [`TS8022`](https://typeshade.dev/ko/reference/errors/ts8022/) for a read of a constant, [`TS8019`](https://typeshade.dev/ko/reference/errors/ts8019/) for the `any` and `all` folds), and the same emit and the same CPU result from the replacement;
- the same file (`a removed name is not declared by the ambient library`), which fails on a declaration of one in `SHADE_DTS`, and `surface-names.test.ts`, which holds every declared name to WGSL, ECMAScript or the §9.3 table;
- review ([Rule 13.1](https://typeshade.dev/ko/reference/rules/13-1/)) for a new name, which asks the question above before the row or the declaration is added.

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

- [`src/compiler/ts/removed-names.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/removed-names.test.ts#L1)
- [`src/core/spec-conformance/surface-names.test.ts:235`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/spec-conformance/surface-names.test.ts#L235)

## 적용하는 오류 코드

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

**[`TS8004`](https://typeshade.dev/ko/reference/errors/ts8004/) `UNKNOWN_FN`**

파일이 선언하지도 가져오지도 않은 함수를 부르거나, ECMAScript 표기가 있어서 언어에서 뺀 내장 함수를 부릅니다. `arrayLength(xs)`가 그 예이며, 메시지가 대신 쓸 `xs.length`를 알려 줍니다(규칙 9.9).

**[`TS8019`](https://typeshade.dev/ko/reference/errors/ts8019/) `ARITY_MISMATCH`**

호출이나 생성자에서 인자, 요소, 필드의 개수가 맞지 않습니다.

**[`TS8022`](https://typeshade.dev/ko/reference/errors/ts8022/) `UNKNOWN_NAME`**

TypeShade가 풀지 못하는 이름을 가리킵니다. 함수 호출(`UNKNOWN_FN`)이나 타입 이름(`UNKNOWN_TYPE`)은 아닙니다. 라이브러리가 TypeScript 자체를 위해 선언한 이름(`Object`, `Math`, `Symbol`)이나 파일이 enum, 네임스페이스, 클래스, 타입으로 선언한 이름을 값으로 읽으면, 메시지가 그 이름이 무엇인지 알려 줍니다.

## 함께 보기

- [규칙 9.8](https://typeshade.dev/ko/reference/rules/9-8/) 테스트
- [규칙 10.1](https://typeshade.dev/ko/reference/rules/10-1/) 테스트
- [규칙 1.4](https://typeshade.dev/ko/reference/rules/1-4/)
- [규칙 12.1](https://typeshade.dev/ko/reference/rules/12-1/)
- [규칙 13.1](https://typeshade.dev/ko/reference/rules/13-1/)
- [규칙 13.10](https://typeshade.dev/ko/reference/rules/13-10/)
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

- [`docs/language-design.md:1380`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L1380) (설계 문서)
- [`reqs/rules/RULE-0909.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0909.md) (추적 항목)
