8000 GitHub - lazily-hub/lazily-gd: Pure-GDScript binding of the lazily reactive-signals family, as a Godot 4.4+ addon · GitHub
[go: up one dir, main page]

Skip to content
lazily-hubPublic

About

Pure-GDScript binding of the lazily reactive-signals family, as a Godot 4.4+ addon

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

lazily-gd

Pure-GDScript binding of lazily, shipped as a Godot addon.

Status: staged binding with canonical replay. The cell kernel is implemented, and 21 of 23 canonical reactive-graph fixtures replay against it. The two remaining fixtures require a reusable public node-id slot; GDScript handles are RefCounted nodes whose ObjectDB slot stays occupied while the stale handle is retained, so both are explicit capability exclusions. The FAMILY roll-up below is still ~, because the family also holds the thread-safe and async contexts (—) and merge algebra (~, pending a collections/ fixture). The LatestDurableProjectionCore egress fixture also replays against the pure core and reactive shell. Other families remain explicitly unimplemented.

Coverage

Summary — family × language

Family Rust Python Kotlin JS Dart Zig Go C++ C# GDScript
Reactive graph ✅ ~ ~ ~ ✅ ✅ ✅ ✅ ✅ ~
Materialization ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Family sync ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Statecharts ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
View ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Keyed collections ✅ ✅ ✅ ✅ ✅ ~ ✅ ✅ ✅ —
Reactive queue ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Broadcast topic ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Work queue ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
CRDT data types ✅ ~ ~ ~ ~ ~ ~ ~ ✅ —
Lossless tree ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Egress ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ~
Ingress ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Wire codec ✅ ✅ ✅ ✅ ~ ✅ ✅ ✅ ✅ —
Transport & FFI ✅ ~ ~ ~ ~ ✅ ✅ ~ ✅ —
Message passing ✅ ✅ ✅ ✅ ✅ ~ ✅ ✅ ✅ —
Reliable sync ~ ~ ~ ~ ~ ~ ~ ~ ~ —
Durable owner ✅ — — — — — — — — —
Durable capability tiers ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Distributed plane ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Causal receipts ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Security boundary ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Membership ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Coordination ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Presence ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Temporal ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Rate shaping ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Windowing ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Resilience ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Portable stdlib ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Service plane ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —
Instrumentation ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ —

Roll-up rule: a family cell is ✅ only when every required row in that family is ✅; ~ when the family is mixed (some shipped or partial); — when no required row is shipped or partial; ⊘ only when every required row in the family is not applicable. Rows the spec marks MAY (optional) are excluded from the roll-up — declining an optional feature is not a gap.

A family cell summarises 86 feature rows. For row-level marks, per-cell notes, and platform carve-outs see the canonical coverage matrix in lazily-spec.

Requirements

Godot 4.4 or newer. The floor sits at typed dictionaries (Dictionary[K, V]); below it the addon does not merely lose ergonomics, it fails to parse. CI pins 4.4.1 so a newer language feature cannot slip in and break only in a consumer's project.

Install

Install the Lazily Scripts addon from the Godot Asset Library, or copy addons/lazily/ into your project's addons/ directory. That folder is the entire shipping surface — the tests, the fixture runner, and project.godot in this repo are development scaffolding and are not part of the addon. Lazily is a runtime script library, so there is no editor plugin to enable afterward.

Why GDScript, and not a GDExtension over lazily-cpp

lazily-cpp is header-only C++17 and its reactive core is wasm-clean, so a GDExtension is technically viable. It was rejected anyway, and the blocker is consoles, not web: Switch/PS/Xbox Godot builds come from third-party porting houses, so you cannot produce those GDExtension binaries yourself. GDScript ships wherever Godot ships — no binary matrix, no godot-cpp pinning, no per-platform debug/release pairs tracking Godot minor releases.

The design argument points the same way. The wasm-hostile parts of lazily-cpp (transport.hpp, reliable_sync.hpp) are exactly what a Godot SDK should replace with Godot's own WebSocketPeer, so what you actually want from lazily here is the layer with zero native dependencies.

Usage

var ctx := LazilyContext.new()

var celsius := ctx.source(20)
var fahrenheit := ctx.computed(func(k: LazilyCompute) -> float:
	return (k.read(celsius) as float) * 9.0 / 5.0 + 32.0)

# Effects are owned by a scope, never unowned: back-edges in this binding are
# weak, so an unowned Effect would be collected rather than run.
var scope := ctx.scope()
scope.effect(func(k: LazilyCompute) -> void:
	print("%d C = %s F" % [k.read(celsius), k.read(fahrenheit)]))

celsius.set_value(100)          # effect re-runs
ctx.batch(func() -> void:       # many writes, one flush
	celsius.set_value(0))
scope.dispose()                 # tears down members in reverse creation order

Reads inside a compute go through k.read(cell), which forms the dependency edge. ctx.peek(cell) reads without forming one. The tracked read is read() rather than get() because Object.get(property) is a Godot builtin.

Latest-durable projection

LazilyLatestDurableProjectionCore is the transport-free state machine and LazilyLatestDurableProjection is its reactive shell. The shell publishes one aggregate state-version source per real transition; consumers can depend on it through state_reader() and inspect a key with state(key) or the complete deterministic snapshot().

var ctx := LazilyContext.new()
var projection := Lazily.latest_durable_projection(ctx, 1)

projection.upsert_desired("document", 1, serialized_document)
var claim := projection.claim("document", projection.generation())
if claim["claim"] == "claimed":
	var envelope: Dictionary = claim["envelope"]
	# Apply envelope["value"] to the external sink, then acknowledge this token.
	projection.ack_applied(
		envelope["key"], envelope["generation"], envelope["epoch"]
	)

The command surface is upsert_desired, claim, ack_applied, fail_retryable, and reconnect. There is at most one claimed write per key; newer pending epochs supersede older pending work, and reconnect fences results from an older sink generation. This binding does not yet provide lock-backed or async reactive contexts, so it intentionally exposes core and synchronous reactive flavors only.

Development

See CONTRIBUTING.md for the local verification command and binding-specific contributor notes.

License

Apache-2.0 — see LICENSE and NOTICE.

About

Pure-GDScript binding of the lazily reactive-signals family, as a Godot 4.4+ addon

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0