---
title: "규칙 2.3: 표면 이름의 출처, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 2.3(표면 이름의 출처)입니다. A value sometimes has to cross between a representation the compiler chose and one the target has…"
url: https://typeshade.dev/ko/reference/rules/2-3/
language: ko
---

# 규칙 2.3

2장, 표면 이름의 출처 테스트

A value sometimes has to cross between a representation the compiler chose and one the target has: an `f64` and the two `f32` halves that carry it across an interface of `f32`. The compiler must either perform the bridge silently or refuse the program in one sentence naming an ordinary remedy. A spelling of the bridge, under any name, must not be a third option.

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

## 근거

the two honest answers to “the target cannot take this as written” are to make it work or to say what to write instead; a third spelling the author has to learn is neither.

## 출처

the same section of PR [#166](https://github.com/typeshade/typeshade/issues/166); the roadmap’s first rule, “ordinary TypeScript first”.

## 검증 방식

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

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

- `TS8038 F64_ENTRY_IO` (`src/compiler/ts/lower/function.ts`, PR [#166](https://github.com/typeshade/typeshade/issues/166)) for an `f64` on an entry’s `@location` parameter, on an entry I/O struct field, or on an entry’s return, one sentence that names `f32(x)` and the uniform or storage binding as the two remedies (surface §39), pinned by `src/compiler/ts/f64-types.test.ts`;
- a [`TS8003`](https://typeshade.dev/ko/reference/errors/ts8003/) that names no remedy, for an `f64` passed, returned, or assigned where an `f32` is declared (Appendix B);
- the surface-names test, which catches a spelling of the bridge that is a pre-emit id, a second signature of `f64`, or a non-constructor signature of a `vecNf64`, and the front end, which refuses a call of one;
- review, for a spelling under a new id, which none of the cases above catches.

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

- [`src/compiler/ts/f64-types.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/f64-types.test.ts#L1)
- [`src/compiler/ts/lower/function.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/function.ts#L1)

## 설명하는 절

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

- [§39 `f64`: the emulated double](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#39-f64-the-emulated-double)

## 적용하는 오류 코드

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

**[`TS8003`](https://typeshade.dev/ko/reference/errors/ts8003/) `TYPE_MISMATCH`**

연산자나 조건, 선언, 반환, 인자처럼 두 값이 만나는 자리에서 타입이 서로 맞지 않거나, 검사로 좁히지 않은 선택적 값(`T | undefined`, `T | null`, `T | null | undefined`)을 읽거나([규칙 7.10](https://typeshade.dev/ko/reference/rules/7-10/)), 컴파일러가 접는 상수를 WGSL이 거부합니다. 31을 넘는 시프트 양, 0인 제수, 서로 엇갈린 clamp 경계, 범위를 넘는 `f32` 값, `Math.pow(-2., 2.)`처럼 정의역 밖에서 부르는 내장 함수가 그렇습니다.

**[`TS8038`](https://typeshade.dev/ko/reference/errors/ts8038/) `F64_ENTRY_IO`**

에뮬레이트한 double(`f64`나 `vec64`)이 진입점의 IO 경계에 있습니다. `@location` 매개변수, IO 구조체의 `@location` 필드, 진입점의 반환값이 그렇습니다. double은 낮춘 뒤 `f32` 워드 두 개이고, varying은 워드를 따로 보간합니다. `f32(x)`로 좁히거나, 필요한 스테이지에서 double을 읽으세요. uniform과 스토리지 바인딩은 `f64`를 담을 수 있습니다.

## 함께 보기

- [규칙 2.2](https://typeshade.dev/ko/reference/rules/2-2/) 테스트
- [규칙 2.4](https://typeshade.dev/ko/reference/rules/2-4/) 테스트
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

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