Measured 2026-09-19
def size(t):
return t
print(size.__name__) # NilPy: compile error `undefined variable (size)`
f = size
print(f.__name__) # NilPy: AttributeError
Where it shows in a real program
argparse builds invalid <type name> value: 'x' from type.__name__.
tsp/view/main.py passes type=_size, a def. CPython prints
argument --size: invalid _size value: 'wide'. lib/rtl/mimic_argparse.py
falls back to repr, so NilPy prints invalid <function at 0x5ae82b> value.
That case (view --size wide) was left OUT of
test/test_nilpy_argparse_tsp_surface.cases for this reason; put it back when
this ticket lands.
Two halves, one representation
- The static spelling
size.__name__: the frontend knows the def, so it can fold to a string literal. - The dynamic spelling needs the name in the boxed callable. It is the same representation that repr() reads, so fixing it fixes both.