Commit 83a07aff
83a07aff380dMerged
Richard Ramsden <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
README: document Object#inspect support for primitives and arrays
Co-Authored-By: Claude [email protected]
Details
- Commit
- 83a07aff380d
- Parent
- bcbe16aba1fd
README.mdmodifiedView file
@@ -154,6 +154,16 @@
154154
Polymorphic values via tagged unions. Nullable object types (`T?`)155155
for self-referential data structures (linked lists, trees).156156
157+
**Inspect / `p`**: `Object#inspect` is implemented for all primitive158+
types (Integer, Float, String, Symbol, Boolean, nil) and for typed159+
arrays (`int_array`, `float_array`, `str_array`, `sym_array`).160+
`Array#to_s` is aliased to `Array#inspect`, matching CRuby.161+
`Kernel#p` dispatches through `compile_inspect_for` so `p obj`,162+
`obj.inspect`, `obj.to_s`, and `"#{obj.inspect}"` interpolation163+
all produce CRuby-byte-identical output. Not yet implemented for164+
Hash, Range, Struct, user classes, or the polymorphic `sp_RbVal`165+
tagged union.166+
157167
**Global Variables**: `$name` compiled to static C variables with158168
type-mismatch detection at compile time.159169