← board

nilpy: the aggregate builtins

2026-07-31 — mostly done

sum · max · min · any · all · sorted · set were all already implemented (undocumented — no undefined variable for any of them, verified against CPython, no code change needed). Regression added: test/test_nilpy_aggregate_builtins.npy.

type was genuinely missing. Rather than a general type-object builtin (comparable, printable as <class 'X'>, the 3-arg dynamic-class-creation form — none of which any censused corpus needs), implemented the one shape that's actually used: type(x).__name__ recognized as a whole unit in ParseFactor (parser.inc), lowered onto the class instance's existing RTTI pair — GenMakeRttiOfCall + GenMakeClassRefOp(.., 'ClassName', ..), the same machinery x.ClassName already uses. x must be statically tyClass; a scalar or a variant-boxed instance errors loudly (type(x).__name__ needs x to be a class instance) rather than reading a nonexistent RTTI blob, which is what happened on the first attempt (segfault on type(5).__name__ with no such check). Bare type(x) with no .__name__ also errors loudly rather than returning something plausible-but-wrong.

Still open:

Gate

make test-nilpy green with a .npy case per builtin diffed against CPython, + --tier quick + self-host byte-identical.

Log