ludic.ui: props kept an instance, a call's arguments a depth, a loop's index shared, an absent attribute's text without a Value; runtime Value.clear - benchmark 36 -> 20 KB a frame

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 23:46:18 +03:00
parent 46888b6716
commit 51a5e06f5c
10 changed files with 43 additions and 5 deletions

View file

@ -479,6 +479,7 @@ namespace Value {
alias as_float(value) = value_as_float
alias as_str(value) = value_as_str
alias free(value) = value_free
alias clear(value) = value_clear
}
namespace Json {
alias encode(value) = json_encode

View file

@ -69,6 +69,12 @@ function value_put(obj: Val, key: pointer, item: Val) -> Val {
# --- accessors --------------------------------------------------------------
function value_kind(v: Val) -> int { return v.tag }
function value_count(v: Val) -> int { return value_n(v) }
# a list or an object emptied in place, its room kept - for one filled again every frame
function value_clear(v: Val) -> void {
if v.kids == null { return }
List.clear(v.kids)
List.clear(v.keys)
}
function value_as_int(v: Val) -> int {
if v.tag == 7 { return int(float_from_bits(v.num)) }
return v.num