# computeBufferViewContract

A compute buffer view contract record carrying id, sourceId, byteOffset, byteLength, isMutable, and related state.

Last updated: 2026-09-09

Package: compute.buffer | Status: source-declared

Tags: buffer, compute, compute.buffer, cpu, method, source-example, thing, yeho

Describe compute buffer layouts, ownership, transfers, and validation.

```yh
external thing computeBufferViewContract
```

- text id: Stores id as text.
- text sourceId: Stores source id as text.
- int byteOffset: Stores byte offset as int.
- int byteLength: Stores byte length as int.
- bool isMutable: Stores is mutable as bool.
- bool uniqueNonOverlapping: Stores unique non overlapping as bool.
- int sourceGeneration: Stores source generation as int.
- computeBufferViewContract(text id, text sourceId, int byteOffset, int byteLength, bool isMutable, bool uniqueNonOverlapping, int sourceGeneration): Compute buffer view contract.
- ValidationDecision(computeBufferResource source) returns computeResourceDecision: Validation decision.
- Describe() returns text: Describe.

## Use computeBufferViewContract

A complete small caller. Values are illustrative; check the returned result and package requirements before connecting live resources.

Verification: type checked

```yh
using compute.buffer

// Describe compute buffer layouts, ownership, transfers, and validation.
computeBufferViewContract sample = computeBufferViewContract("id", "source Id", 1, 1, true, true, 1)
Console.Log(Text.From(sample.id))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_buffer__computebufferviewcontract"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.buffer"
version = "0.1.0"
path = "../../../yeho/packages/compute/buffer"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.buffer--computeBufferViewContract/usage --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## computeBufferViewContract.ValidationDecision

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.buffer

// Validation decision.
computeBufferViewContract instance = computeBufferViewContract("id", "source Id", 1, 1, true, true, 1)
computeBufferResource argument_source = computeBufferResource("id", "device Id", "memory Class", 4, 4, true, true, true, true, 1, "state", "external Identity")
computeResourceDecision result = instance.ValidationDecision(argument_source)
Console.Log("Inspect result in your debugger")

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_buffer__computebufferviewcontract"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.buffer"
version = "0.1.0"
path = "../../../yeho/packages/compute/buffer"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.buffer--computeBufferViewContract/method-ValidationDecision-8 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## computeBufferViewContract.Describe

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.buffer

// Describe.
computeBufferViewContract instance = computeBufferViewContract("id", "source Id", 1, 1, true, true, 1)
text result = instance.Describe()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_buffer__computebufferviewcontract"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.buffer"
version = "0.1.0"
path = "../../../yeho/packages/compute/buffer"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.buffer--computeBufferViewContract/method-Describe-9 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Package presence and a declaration do not establish support on every host. Host services need their platform and lifecycle setup.

Source: yeho/packages/compute/buffer/contracts.yh

AI training permission: https://demonhunterlabs.com/ai-use
