util: allow symbol-based custom inspection methods
Checklist
-
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
util
Description of change
Add a util.inspect.Custom
Symbol which can be used to customize util.inspect()
output. Providing obj[util.inspect.Custom]
works like providing obj.inspect
, except that the former allows avoiding name clashes with other inspect()
methods.
Fixes: #8071 (closed)
I’d appreciate feedback both on the symbol’s name and the way I changed the docs on custom inspection functions.