Repository navigation
Decision: a boolean type (#1286 booleans row → CHANGE) #1637
Description
Activity
- addedarea:runtime-vmSubsystem: runtime-vmSubsystem: runtime-vmkind:decisionNeeds a decision recorded, not (only) codeNeeds a decision recorded, not (only) code
on Oct 6, 2026 InauguralPhysicist commented
on Oct 6, 2026 CollaboratorAuthorMore actionsDesign note (Jon, 2026-10-06): the slot layer already has the boolean type. Above it, the code discards it. Verified on origin/main:
src/value_slot.h: tag0xFFF9= BOOL (low bit = value), withslot_is_bool,slot_as_bool,slot_from_bool,slot_true/slot_false, and the refcount fast path treating it as an immediate.- The slot layer already prints bools as
true/false(src/vm.c:120,src/trace.c:2714). - No producer:
slot_from_boolhas no callers. Comparisons build numbers. - Seven sites collapse a bool slot into a number when converting to a
Value:src/eigenscript.c:1791, andsrc/vm.clines 800, 840, 4042, 4408, 4490 and 6558 (make_num(slot_as_bool(s) ? 1.0 : 0.0)). TheValueenum (src/eigenscript.h:253) has noVAL_BOOLfor them to target.
So the core of this change is to stop discarding the bool:
- add
VAL_BOOLto theValuelayer; - make the comparison opcodes and
notemitslot_from_bool; - replace the seven collapses.
The rest of the Done-when list still applies: keywords, JSON, arithmetic-raises, JIT fast paths, tape versioning, the AOT, and the consumer sweep.
InauguralPhysicist commented
on Oct 6, 2026 CollaboratorAuthorMore actionsTracked as phase 1 of the value-model release #1644. Phase 1 lands and is released alone, because it unblocks EigenLua's Tier S. Phases 2-4 (numbers, strings, map keys) then share one tape bump and one consumer sweep. This issue's touch map is the template checklist for those phases.
- added a commit that references this issue
on Oct 6, 2026 InauguralPhysicist commented
on Oct 6, 2026 CollaboratorAuthorMore actionsOwner decision (Jon, 2026-10-06): bools as dict keys are DEFERRED to phase 4 (map keys) of #1644, unless a consumer needs them earlier. Item 6's "bools are valid dict keys" is superseded for this phase. In #1647,
{true: 1}/d[true]raise like any non-string key. Phase 4 decides bool, number and int/float key unification together, with the guest-language matrix's worst-case target.- added 9 commits that reference this issue
on Oct 6, 2026 17 remaining items
- added 14 commits that reference this issue
on Oct 6, 2026
Owner verdict, 2026-10-06: #1286's "Booleans folded into another type" row is change. Jon: "kind of a ridiculous gap to have for EigenScript at its current build." This is the next EigenScript work, ahead of Lua rung 1 round 2.
Why now (measured)
falseprints as0, so the grader'sassertcheck fails. 9 of 47 differential programs differ from PUC-Rio Lua only in booleans. Details: the Pre-adoption: language decisions to settle while we are the only users (lessons from other languages' v1 regrets) #1286 measurement comment.1 == 1gives1of typenum;not 0gives1; there is notruekeyword.json_encode of [1 == 1]gives[1], so JSONtrue/falsecannot round-trip.Decided semantics
bool, with keywordstrueandfalse.type of trueis"bool".bool: comparisons (== != < <= > >=),not, and boolean-returning builtins/predicates.and/orkeep returning an operand, as now.true/false. JSON:json_encodeemitstrue/false;json_decodeoftrue/falseyieldsbool.0,0.0,null,"",[]and{}stay falsy;falseis falsy andtrueis truthy (SPEC §truthiness gains the two values).true + 1,sum of [1 < 2]and every numeric builtin given a bool raise a type error. Converting is explicit (e.g.if c: 1 else: 0, or a documentednum of bif one is added). This matches the fail-soft-to-loud direction (Architecture review: finish the fail-soft→loud reform (2026-08-18 whole-language ledger) #975).true == 1andfalse != 0are type errors, like arithmetic, so the ~300 existing(pred of x) == 1checks fail loudly and are migrated (toif pred of x:or== true) instead of silently flipping. Other mixed-type comparisons stay unequal as today (null == falseisfalse,"true" == trueisfalse). Bools are valid dict keys. Correction: an earlier version of this issue saidtrue == 1isfalse. That was the orchestrator's assumption, not an owner decision.Surfaces that must move together (touch-all-sites)
print/str/repr,type of, JSON,==/hashing.1/0.Done when
numagain; the new tests go red.#1286's table records the verdict with a link here.assert_semanticsprobe and the 9 boolean-only D rows re-graded, with the score posted here.