-
Effekt Library
- ref
- Ref
- allocate
- ref
- get
- set
- ref Jump to source: libraries/common/ref.effekt
- Ref
[T]
- allocate
[T]: Ref[T] / {}
- ref
[T] (init: T): Ref[T] / {}
- get
[T] (ref: Ref[T]): T / {}
- set
[T] (ref: Ref[T], value: T): Unit / {}
Example usage: examples/stdlib/ref
Global, mutable references
Allocates a new reference, keeping its value _undefined_. Prefer using `ref` constructor instead to ensure that the value is defined.
Creates a new reference with the initial value `init`.
Gets the referenced element of the `ref` in constant time.
Sets the referenced element of the `ref` to `value` in constant time.