---
title: "Rule 8.6: Functions and entry points in TypeShade"
description: "Rule 8.6 of the TypeShade language design, in Functions and entry points."
url: https://typeshade.dev/reference/rules/8-6/
language: en
---

# Rule 8.6

Chapter 8, Functions and entry points Test

An entry point must not be called from another function, and neither may a kernel function ([Rule 8.22](https://typeshade.dev/reference/rules/8-22/)).

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

## Rationale

WGSL forbids it, and an entry’s parameters are stage inputs no caller can supply. A kernel function’s arrays are the call’s storage, which no shader function can hand over, and its loops are dispatches the host makes.

## Derives from

[Restrictions on Functions](https://gpuweb.github.io/gpuweb/wgsl/#function-restriction) (“an entry point must never be the target of a function call”).

## 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:

[`TS8099`](https://typeshade.dev/reference/errors/ts8099/) (`"fs" is a fragment entry point and cannot be called; the pipeline invokes it. Move the body into a plain function and call that from both.`), pinned by `src/compiler/ts/operators-statements.test.ts` (`refuses calling an entry point`) ([#160](https://github.com/typeshade/typeshade/issues/160)); for a kernel function `TS8099` (`"total" is a kernel function, which host code calls and whose arrays are the call's storage, so no function can call it. …`), pinned by `src/compiler/ts/kernel-loops.test.ts` in the compiler and the language service.

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

- [`src/compiler/ts/kernel-loops.test.ts:3`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/kernel-loops.test.ts#L3)
- [`src/compiler/ts/operators-statements.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/operators-statements.test.ts#L1)

## Explained in

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

- [§65 A loop that runs as a kernel](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#65-a-loop-that-runs-as-a-kernel)
- [§68 Importing another shader module](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#68-importing-another-shader-module)
- [§72 The common algorithms: `typeshade/algorithms`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#72-the-common-algorithms-typeshadealgorithms)

## Error codes that enforce it

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

**[`TS8099`](https://typeshade.dev/reference/errors/ts8099/) `UNSUPPORTED`**

The catch-all for a diagnostic whose site does not yet deserve its own code. It stays parked at TS8099, past the sequential range.

## See also

- [Rule 8.5](https://typeshade.dev/reference/rules/8-5/) Test
- [Rule 8.7](https://typeshade.dev/reference/rules/8-7/) Test
- [Rule 8.22](https://typeshade.dev/reference/rules/8-22/)
- [Design rules](https://typeshade.dev/reference/rules/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

The rule at commit af54ddad5:

- [`docs/language-design.md:826`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L826) (the design document)
- [`reqs/rules/RULE-0806.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0806.md) (its traceability item)
