eval(): symbol t self-evaluates BEFORE env lookup — t params receive #t (super/mill loan hooks return NaN, super never bids loans) #98
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by exp4 during its #97 duel work, verified by the communicator against source.
Bug
eval()in lisp.go (line ~433): for a symbol, the checkif v.str == "t" { return trueVal }runs BEFOREenv.get(v.str). So any function with a parameter namedtcan never read its argument: the self-evaluating#tconstant shadows the binding.Repro:
((lambda (t) t) 7)evaluates to the symbolt(trueVal), not 7.Consequences (measured)
ai/super.lisp:q-term (h t),loan-charge (n t),bid-for (n t level)all take atparam.loan-chargecomputes NaN (0/0), the cap check inbid-forfails, andbid-forreturns 0. Super NEVER bids on a loan, in ANY preset. Its 59-win canonical baseline is deposits/bonds/auctions only (diag spectate: super's pending bids = empty map while empire bids all 5 loans).ai/mill.lisphas the same class of bug (loan-rateparamt-> NaN). Mill wins the duel by being last standing in the corpse cascade, not by lending.Fix options (Robert to rule)
#tused as a value still works — it's unbound, so the fallback fires) AND restorestparams. One-order change in eval().(defun f (t) ...)silently gets #t.Option 1 is a 1-line order swap plus tests; option 2 is what exp4 is already measuring locally for its duel lane. Whichever lands, super's true baseline (with live loan bidding) is unknown and will move — every experimenter's numbers should be re-baselined after the fix.
Refs: #97 (live work), exp4 report /root/bw85-reports/exp4.md on the host.
my understand is t should have nothing to do with #t as those are completely different symbols, they shouldn't even be muddieable. I think your fix should tackle this aspect first. @Winnie
Fixed. PR #99 (branch 98-tfix @
3fdce18), review requested. Root cause confirmed: my #89 fix ordered the checks wrong — t self-evaluated before the env lookup, shadowing every t-named parameter. super.lisp's q-term/loan-charge/bid-for all take t, so loan-charge went NaN and super never bid a loan; mill has the same class.Fix: bindings first (env, then builtins); the t constant is only the fallback for a genuinely unbound t, so #t-as-value (#89) still works. Tests pin both directions: t params receive arguments, and #t values stay truthy. Full suite + vet + smoke seed 33 clean.
After the merge the #97 team re-baselines: super's true number with live loan bidding is unknown and will move.
Ruling implemented exactly as stated: t and #t are now completely different symbols. PR #99 @
3a2d449(force-pushed over the earlier order-swap draft).No muddling is possible by construction. Tests cover both directions (t params receive args; t definable; #t truthy alongside a numeric t; unbound symbols still error). Full suite + vet + a seed-33 spectate with the canonical super.lisp clean. After merge the #97 team re-baselines everything.